Saturday, July 25, 2015

Arduino Uno

     I got an Arduino Uno starter kit for the grandson (Moose) to learn electronics with. The Arduino is a microcontroller that uses a programming IDE called Sketch. It is very simular to C++. This has been an interesting ride so far.
     We started by playing an LED and getting it to dance as we saw fit. This taught us how to assign and control the ouputs of the Arduino.
     We then moved on to playing with an orchestra of 13 LEDs. Then we moved to playing with a seven segment display.
     This where things got messed up. The guide we were using had goofs in just about every program. I had helped Moose in figuring them out, but this was getting rediculous. I had Moose typing most of the code in by hand instead of copying the code from a pdf. This was to instil the syntax of programming. But most of the time when I couldn't find the error in the code, I resorted to the web for solutions or a whole other example code to use. This is how the rest of these projects went.
     The seven sevment display proved challenging as it introduced the use of functions. These functions are alot like the old familiar subroutines from other programming environments.
     We then moved on to a 4-digit segment display. That had just about used all of the I/O the Uno had. That is where the idea of getting the 74HC595 shift register to work. But, we had other playing to be had yet. This code was robbed from some forum online. As I also tried to get it to multitask 6 LEDs also.
     I had found that the Arduino does not multitask, as it does not have an OS, but only a bootloader to allow the Sketch programming. In order to "multitask", we had to ditch the delay(x) commands, (witch just tells the processor to wait for the specified time. It does nothing during that time but kicking rocks.) and start managing time. So, in doing that, I got it to drive the 4-digit display with a counter and flash 6 LEDs without skipping a beat.