Circuit_04_Potentiometer code example
Example: Circuit_04_Potentiometer
int sensorPin = A0;
int ledPin = 13;
int sensorValue = 0;
void setup() {
pinMode(ledPin, OUTPUT);
}
void loop() {
sensorValue = analogRead(sensorPin);
sensorValue = map(sensorValue, 0, 1023, 0, 255);
analogWrite(ledPin, sensorValue);
}