Working on Potentiometer in Arduino inalog.
Electronic Part Requirements.
Arduino UNO/MEGA/PRO/
1x 10k Potentiometer
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
/* . . ........ .... .. ...... ........ MMMM MMMMM MMMMMMMMMMMMMMMMMMM MMMMMMMMMM. MMMMMMMMM MMM.MMMMMMM MMM MMM .MM.MMM MMM ......... .... ... . . . MMM MMMMMMM . .MM. MM. MMM MM. . MMM MMMMMMMMM MMMM MMMMM.MM MM MMMMMMMMMMMM. .MMM MMM. .MMM.MMMMMMMMM ........ MMM MM . M .MMMMMMMM. MMM .MMM MMMMMMMM.MMMMMMM. MM .MMM. MMMMMMMM. MMM .MMMM MMMM MMMMMM. 14core.com . ... . . ...... */ int potpin = 0 ; int ledpin = 13 ; int val = 0 ; void setup() { pinMode(ledpin,OUTPUT); Serial.begin(9600); } void loop() { digitalWrite(ledpin,HIGH); delay(50); digitalWrite(ledpin,LOW); delay(50); val = analogRead(potpin); Serial.println(val) ; } |
Download the source code here | 14coreanalog
Starter #8 Using Analog in Arduino with Potentiometer