Lab 2: Arduino Introduction

Note

This is an individual assignment, but again, work with your team to figure things out. I am providing the hardware needed for this assignment, but I do not have enough boards for each student in the class, so you will need to share a board with at least one other student. All boards must be returned before you leave class.

Introducing Microcontrollers

We will be learning how to create programs where speed is critical. That does not mean just blazing fast, as you probably think. Instead, the speed we seek is precisely controlled.

This kind of programming is needed when we want to interact with hardware, either to receive data from a sensor, or to actuate some kind of device like a motor, or even a simple LED light.

We will use versions of chips manufactured by Atmel (now part of MicroChip) for this work, and one of the easiest to find examples of these chips is found on the Arduino board, available from many sources for prices as low as around $4 on Amazon.

../_images/arduino-uno.jpg

Since you probably do not have such a system, I will provide a set of these devices for you to use during our lab sessions. All you will need for this first lab is a board, a USB cable (provided) and a PC with suitable software installed.

Note

All lab machines have this software installed. It is a simple download for any system. This software can be installed inside of your VM, but you need to enable USB support to get the VM to communicate with the Arduino board.

Arduino Software

The Arduino board was designed for non-programmers, even kids, to learn about programming, and using simple computers to interact with their world. The software normally used is and available for free from their website.

Like all IDE systems, this one is a wrapper around the core tools needed to create programs. In our case, that wrapper surrounds a version of the same compiler we are using in our work on Linux, the Gnu C/C++ compiler. This version produces code for an tiny 8-bit processor. You run the compiler on the PC, and load the resulting program onto the board over the USB cable. Power for the board is provided by the USB cable as well. You can power the board off of a battery after you load the program. Programs are loaded into flash memory, so they remain even after you remove power.

Warning

Arduino programs will look a bit strange. You write only two simple functions. All of the rest of the code will seem to be missing, but the IDE will add that before your code is compiled.

Your Problem

This is not going to be very hard, but you have some digging to do. There are two things you need to accomplish.

Processor Details

The first challenge, which does not need the board to complete, involves writing up a short note describing the chip on this board. This needs nothing but your Googling skills to produce.

This note, and all documentation you create for the rest of this class, must be written in a text file using reStructuredText. It can include images, and links to references if you like. Exactly how you make that happen can be found by looking for a reStructuredText tutorial, which is easy to find. (You can even examine the source code for any of my notes, including this one, to see how to do that).

You are not writing a book, just a short note. The final result should display nicely on GitHub after you “push” your lab assignment to GitHub.

Submitting any other format will be graded as a zero for this half of the assignment.

Blinking a Light

This part should be simple, and a bit of fun.

I want you to blink the onboard LED light. Not just on and off, that would be too easy. There is even example code provided with the IDE showing how to do that. I want you to cause the LED to display “COSC2325” in Morse Code. (Oh no, more Googling.)

You will demonstrate this part of the lab in class, by bringing your programmed board to my station. We will plug it in and watch it go. (I do know Morse Code, so I can visually confirm this part.)

I will bring a set of the required boards to class each day as needed to complete this half of the assignment.

Have fun with this.