You are on page 1of 2

Owen R.

Largo BIT – CT 3B DAY 11/8/2021

SUMMARY

On this project, a DIGITAL HOURGLASS is being built. During this project I will learn
about tilt switches and how to use them. In addition, I am using the millis() function , which is
going to replace delay(). Long variables are being introduced too. The first step is to understand
what a tilt switch is and when I am going to use it. It is quite similar to a normal switch, and as a
digital input has two levels (end and power). As it has been mentioned, this kind of switch
detect when is being rotated. This is because there is a small metal ball inside which make
contact and close the circuit when tilting the switch in the appropriate direction. In order to
advice when time is about to finish the LEDs start blinking. To create this project, I will need 8
LEDs, 2 tilt switch, one 10k Ohms and eight 220 Ohms resistances. I should have noticed that all
the outputs and inputs are digital. There is no specific difficult on mounting de circuit. As I have
already mentioned, I am using the millis() function. Due to it doesn’t paralyze Arduino as delay()
does. When delay() is being executed it is impossible to work with inputs and outputs at the
same time. That’s why, in this project were time is quite important, we are avoiding this
function. As you might notice, in the following code long variables are being used. Until now, I
have only used int, but in some cases they won’t be enough. An int variable is a number of 16
bit (it can storage decimal numbers from -32768 to 32767) while a long is 32 bit (can storage
from -2147483648 to 2147483647). Knowing that Arduino counts 1000 times per minut using
millis() and investing time on making the properly calculations you will discover that to create
the hourglass a long variable is required. In fact, it is used an unsigned long which means that
all the numbers are positive.
Owen R. Largo BIT – CT 3B DAY 11/8/2021

You might also like