A blinker

When a newbie starts learning a computer language, the first ever program is normally to print “Hello World !”.   In embedded systems, printing something on a display takes some time and knowledge.  Normally a student starts learning a micro controller by blinking an LED. A controller can easily handle a bit and it can make it ON and OFF as and when required.

Arduino makes it still more easy to blink an LED. You can use Arduino IDE to develop avr micro controller programs . TINAH board is a very simple board that allows you to do so. TINAH is an open project by Techno e-School.

First sketch: LED blinking

If you look at the source code of LED blinker, you will see how easy it is to write a sketch.

  1. The setup section contains commands that are run by the controller only once.
  2. The loop section contains commands that are repeated by the controller continuously.

Because we write the commands in the loop section which make the LED on and off, the LED is going to blink “forever” (i.e. till the circuit is powered up). This also means:

  1. That the sketch works like an oscillator of frequency 0.5Hz and 50% duty cycle.
  2. By changing the on and off time durations, we can change the duty cycle and the frequency. We can reach up to 500Hz.
  3. When the delay numbers are small enough, no one will see LED flickering due to persistence of vision. But on digital pin 13, a square wave is produced and can be measured on a frequency meter or an oscilloscope.
  4. We can also use the same sketch (after some modifications) to generate a pulse width modulation based Digital to Analog Converter.

Thus a simple LED blinker sketch and circuit can be used for other purposes also.

%d bloggers like this: