Arduino project # 5. Pulse width modulation. Lighthouse

Pulse width modulation. Lighthouse

Hi all! Today I am going to create a lighthouse using pulse width modulation, which means the LED will be turn on and off very quickly, so you just see it lighter or darker. For this purpose there is a function in Arduino analogWrite().  It takes two arguments: pin and value from 0 to 255 (how often per second pin will be on high level of voltage).

As you can see from the picture we also need to use one resistor (220 Ohm).

 

Video:

 

Code here:

Tagged :

Leave a Reply

Your email address will not be published. Required fields are marked *