Go Down

Topic: LED glowing time calculation (Read 575 times) previous topic - next topic


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.


What do you mean by "I glow it for 30 seconds"?  How is the LED turned on and off?
Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e


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.


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


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

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

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