#define POT_PIN A0
#define LED_PIN 5
int pot = 0;
int mapped = 0;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
pot = analogRead(POT_PIN);
Serial.print("Raw pot reading: ");
Serial.println(pot);
mapped = map(pot, 0, 1023, 0, 255);
Serial.print("Mapped pot reading: ");
Serial.println(mapped);
analogWrite(LED_PIN, mapped);
//analogWrite(LED_PIN, pot);
}