Suppose a simple delay is there
(Its not for a particular program but any of the random one)
Like we use to define it first and then rest of things
int dr = 100;
delay(100);
Now I want to make changes in the value of dr in real time mode with the help of a simple
potentiometer or volume control via analog pin
Please Guide me in doing that
Thanks !!!!!!!!
Did you mean this?
int dr = 100;
delay(dr);
For potentiometer on A0 and delays from 0 to 1023 milliseconds:
delay(analogRead(A0));
For delays from 0 to 5.115 seconds in steps of 5 milliseconds:
delay(5 * analogRead(A0));
Ideally, a linear taper pot !
I see
Ok what would be the value of potentiometer
Its 10k or 5k or 47k or something else ??
Anything from 1k to 10k will work fine. 10k is probably best.
I am going to define it like
int DelayPot = analogRead(A0);
Is it all good ??
Yes, if you put that line in loop().
void loop()
{
int DelayPot = analogRead(A0);
.
.
.
delay(DelayPot);
}
Ok fine then !!
Is it possible to choose any of the analog input other than A0
I am on Mega right now !!!
Yes. Pick any of the 16 analog inputs.
Ok done !!
Well is it possible to write something defined for
digitalWrite(IndiLiteA,0);
when it repeat itself so many times like more than 50 suppose
Want to save space !!!
Which type of wiring I need to have ??
Just left and right pin to Vcc and ground
and centre one to A4 ??
Like as usual ??
alto777
14
My sources from beyond the grave say "Proceed!".
a7
Yeah Sir this one is working
Thankssss !!
Its blinking too fast to identify with an LED at PIN 13 or PIN 12 and lower value at POT
Can we limit the value there so as to identify the blinks ??
Yes you can. You have to specify what the lowest and the highest blink-frequency shall be and then use
the c++ function map()
O map function
Oh ok Thanks 
Surely I ll check !!
system
Closed
19
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.