Understanding Arduino 101

Version 2

    genuino 101.png

    Working with Arduino Microcontrollers such as the Genuino 101 requires an understanding of the Arduino code underpinning the project.

     

    The Arduino coding language is an open source software package that allows you to communicate with the Arduino Microcontroller. We upload our written programs to our Arduino Microcontroller by connecting it to the computer via  a USB lead.  Let's look at the basics of Arduino and Microcontrollers

     

    Step 1

    Knowing your 101

    Taking a look at a Microcontroller such as the 101 you will see there are a number of input or output ports called pins. On the 101, as with most Arduinos, they are numbered. In this case from 1 to 13.

     

    In addition you will notice other ports including one labelled GND or ground. The ports are numbered so that we can program the inputs and outputs we connect to each of these ports, but more on that later.

     

    Step 2

    Open Arduino

    If you have not already installed the Arduino Software, access the getting started guide. Otherwise open Arduino and then click on File >> Examples >> Basics >> Blink to open the most basic of Arduino code

     

    Step 3

    What does the code do?

    This code, as the name suggest makes an LED blink or flash. To understand the code we will take a look at the 3 main sections:

    Naming; Setup; Loop (Program section)

     

    Step 4

    Naming components

    Here we are naming the output   pin 13 on the 101 (remember all the pins are numbered) LED just to make things easy. This way when writing and troubleshooting  code we are looking not for 13 but LED. When you work with motors, servos etc, you can name these as such too, to make your and your students lives easy

     

    Step 5

    Setup the board

    Physical computers, such as the 101,

    “Sense” input then decide what to“Do” by processing, resulting in an output or “Reaction”.

    This section of code is just letting the 101 know whether it needs to be ready to sense or react. In this case we have connected an LED, or an output, to point 13 so we call it an output. If we were planning to connect a light or sound sensor, we would need to call it an input.

     

    Loop

    The first line digitalwrite(led, HIGH) is telling the microcontroller to turn up the voltage to output, or port, 13 to high, in other words turn the power on. This will turn on our LED. In the second line, 'delay' is basically saying 'wait'. It is represented in milliseconds, so in this case wait for 1 second (1000ms = 1s love maths at work) before doing anything else. The second last line of code digitalwrite(led, LOW) is telling the microcontroller to turn down the voltage to output 13, turning the LED  off.

     

    Now get Innovating and Creating!

     

    Working with Arduino Microcontrollers such as the Genuino 101 requires an understanding of the Arduino code underpinning the project.