Pages: [1]   Go Down
Author Topic: LED glowing time calculation  (Read 413 times)
0 Members and 1 Guest are viewing this topic.
Chennai, Tamil Nadu, India
Offline Offline
Newbie
*
Karma: 0
Posts: 7
Arduino ROCKS!!...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hai All,
     By using arduino uno I want to display the LED glowing time in serial window say example if I connected one LED in 2 pin and I glow it for 30 seconds means in the serial window I want to show 30 sec like that. Please  guide me.
Logged

Massachusetts, USA
Offline Offline
Tesla Member
***
Karma: 201
Posts: 8699
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

What do you mean by "I glow it for 30 seconds"?  How is the LED turned on and off?
Logged

Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 601
Posts: 48543
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
How is the LED turned on and off?
Equally, why can't you record when that happens, using millis()?

Every time the LED turns off, subtract the on time from the off time, to get the duration, and increment the total duration by that amount.
Logged

Topsham, Vermont USA
Offline Offline
Edison Member
*
Karma: 32
Posts: 1867
... in The Woods In Vermont
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

vennishmuthu, maybe start with one of the example software sketches that comes with every Arduino installation: Use the menus to find:

File>Examples>Digital>BlinkWithoutDelay

Use that to understand about the millis() variable. 

Add a variable to save the time the LED will be on.  Send that data also to the serial monitor. 

Start experimenting and learning...

Logged

Regards, Terry King terry@yourduino.com  - Check great prices, devices and Arduino-related boards at http://YourDuino.com
HOW-TO: http://ArduinoInfo.Info

Pages: [1]   Go Up
Jump to: