Go Down

Topic: Increase delay time(Reading a Potentiometer) (Read 1 time) previous topic - next topic


Hi to all,

I have connected potentiometer to arduino as per instruction and all the stuff are working very well, but in this m getting max one second of delay. i want variation between 1-10 sec if possible. also i have triad with all value potentiometer (1k, 22k, 47k, 100k)




You haven't posted any code (Hint), but I'm guessing the maximum delay is actually around 1.023 seconds.
The value of the potentiometer (aka "potential divider" or "voltage divider") has no effect on the value read, the analogue inputs read voltages.
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.


I am using this code.

Code: [Select]

/* Analog Read to LED
* ------------------
* turns on and off a light emitting diode(LED) connected to digital 
* pin 13. The amount of time the LED will be on and off depends on
* the value obtained by analogRead(). In the easiest case we connect
* a potentiometer to analog pin 2.
* Created 1 December 2005
* copyleft 2005 DojoDave <http://www.0j0.org>
* http://arduino.berlios.de

int potPin = 2;    // select the input pin for the potentiometer
int ledPin = 13;   // select the pin for the LED
int val = 0;       // variable to store the value coming from the sensor

void setup() {
  pinMode(ledPin, OUTPUT);  // declare the ledPin as an OUTPUT

void loop() {
  val = analogRead(potPin);    // read the value from the sensor
  digitalWrite(ledPin, HIGH);  // turn the ledPin on
  delay(val);                  // stop the program for some time
  digitalWrite(ledPin, LOW);   // turn the ledPin off
  delay(val);                  // stop the program for some time

or is there any way to make timer project by arduino.
and i want to controll timer by Potentiometer and want to control delay between 1 sec to 10 sec


So, increase the delay factor by 10:
Code: [Select]

  val = analogRead(potPin) * 10;



Apr 25, 2013, 02:15 pm Last Edit: Apr 25, 2013, 02:17 pm by chetan0412 Reason: 1
Thanks billroy

its working now.....

thank you soooo much...

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131