-1
int ledPin = 13; // pino do led
int analogPin = 3; //pin for potentiometer reading
int val = 0; //variable to store the read value
void setup()
{
pinMode(ledPin, OUTPUT); // sets pin as output
}
void loop()
{
val = analogRead(analogPin); // le the analog value
analogWrite(ledPin, val / 4); // triggers led with the analog value read divided by 4
}
What version of Arduino are you using? Uno, Due, Mega, Mini?
– Mauro Rocha
I’m using the UNO
– TiadoDev