Can we give potentiometer value via program
Title
Question
Sir,
I have a small doubt that can we give the potentiometer value through arduino code itself instead of rotating the knob of potentiometer. If so please let me know.
Arduino Pulse-Width-Modulation 11-12 min 0-10 sec
Answers:
Yes you can. Instead of motorValue = map(potValue, 0, 1023, 0, 255);directly provide motorValue as some integer between 0 and 255.
eg, motorValue = 150;
eg, motorValue = 150;
A better and fun way will be to initiate Serial and input values real-time directly from serial monitor and pass it to motorValue.The command for passing values from Serial will be : motorValue = Serial.read();
Cheers!
Cheers!
Login to add comment