top of page

6-Digital Hourglass


DISCOVER: long data type , creating a timer

in this project , we build a Digital Hourglass that turn on an LED every 10 minutes . know how long you are working on your project by using the arduino's built-in-timer , i use it to determine one hour for reading a book called " STUDY TIPS "

when you've wanted something to happen at a specific time interval with the arduino you've used delay() this is handy but a littile confining when the arduino calls delay() it freezes it's current state for the duration of the delay , delays are also not very helpful for keeping track of time

the millis() function helps to solve this problems , it keeps track of time

the datatype you use for delay() function is an int (integer) , it's a 16-bit number it holds value between -32,768 and 32,768 , if the arduino is counting 1000 times a second with millis() you'd run out of space in less than a minute

the long datatype holds a 32-bit number (between -2,147,483,648 and 2,147,483,648) since you can't run time backwards to get negative number the variable to store millis() time is called unsigned long , this allow you to count even higher .

INGREDIENTS : switchs , LED , resistors , piezo

العلامات:

Recent Posts
Archive
Search By Tags
bottom of page