keyestudio
val=analogRead(potpin);// read the analog value from the sensor and assign it to val
Serial.println(val);// display value of val
analogWrite(ledpin,val/4);// turn on LED and set up brightness ( maximum output of PWM is 255)
delay(10);// wait for 0.01 second
}
//////////////////////////////////////////////////////////
Result
After downloading the program, when we rotate the potentiometer knob, we can see changes of
the displaying value, also obvious change of the LED brightness on the breadboard.
*******************************************************************************
www.keyestudio.cc
26
Need help?
Do you have a question about the ARDUINO maker learning kit and is the answer not in the manual?