Pages: [1]   Go Down
Author Topic: Increase delay time(Reading a Potentiometer)  (Read 508 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Jr. Member
**
Karma: 0
Posts: 58
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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)

http://www.arduino.cc/en/Tutorial/Potentiometer

thanks,
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 291
Posts: 25876
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

"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.

Offline Offline
Jr. Member
**
Karma: 0
Posts: 58
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I am using this code.

Code:
/* 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
Logged

0
Offline Offline
God Member
*****
Karma: 39
Posts: 988
Get Bitlash: http://bitlash.net
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

So, increase the delay factor by 10:
Code:
  val = analogRead(potPin) * 10;

-br
Logged

Offline Offline
Jr. Member
**
Karma: 0
Posts: 58
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks billroy

its working now.....

thank you soooo much...

« Last Edit: April 25, 2013, 07:17:44 am by chetan0412 » Logged

Pages: [1]   Go Up
Jump to: