Spaceship Interface with Arduino
This my second follow up post about my journey to learn and understand Arduino electrical prototyping.
In short, Arduino is a programmable logic controller, or microcontroller with a piece of software. If you are like me — who likes tinkering with electronics but find it hard to start, Arduino is the right place to learn.
This is what I have been learning after acquired an Arduino Starter Kit. It came with a book too. The book basically teaches you the concept of electricity and how to control things using some codes (C++ to be precise).
Switches — Digital Input and output
In this lesson, I learned about the basic commands to ‘turn’ ON and OFF some LEDs.
To begin, they do not name the inputs ‘ON’ or ‘OFF’ in codes nor use the ‘0’ and ‘1’. Instead, we can communicate with it by stating giving out the commands “HIGH’ and ‘LOW’. Is it basically saying, “Hey, there’s voltage there!”
HIGH = On. LOW = Off
So, in the codes, we can configure the UNO board by using this function called digitalWrite() .
digitalWrite() basically check a digital input of a pin (on the circuit board). Since its job is check the state of input from a particular pin, hence, it needs only two arguments — what pin is it, and what is the value of that pin, is it HIGH or LOW?
digitalWrite(3, HIGH); // LED at pin 3, is turned ON
digitalWrite() is the command that allows you to send 5V or OV to an output pin.
With an additional if/else conditional lines. I managed to program the UNO board as spaceship control pad. By pressing the main switch with my index finger, two LEDs will start to flicker to indicate that the spaceship is ready to thrust into the sky.