AT 219 Lab 3 - Introduction to Programming Arduino
This weeks lab consisted of getting familiar with using the Arduino IDE to program the arduino. We made a number of "sketches" to program different basic functions.
The first exercise was to use the serial monitor to print "Hello World!" Getting familiar with the serial monitor is important as it can be used to display text from the arduino. The code looks like Figure 1. This program will print "Hello World!" a single time.

The next exercise was to build on this so that the code that prints "Hello World!" will loop indefinitely.

The next exercise uses the built in led to blink in a morse code SOS pattern (...---...). This pattern is looped indefinitely.


I also hooked up the debug board to pin 13, which uses the same functionality as LED_BUILTIN, so the LED blinked on that as well (Figure 5).

After this, I moved on to experimenting with some analog inputs. Arduinos are capable of reading inputs from analog devices. The first exercise consisted of wiring a potentiometer to be read by the arduino. The code in figure 6 reads the incoming value from the potentiometer and prints it in the serial monitor. The circuit can be seen in figure 7.


The final exercise was to use the potentiometer to control an LED. To achieve this, the arduino must receive the analog signal from the potentiometer and translate it into a digital value, which can then be stored in a variable that determines the brightness of the LED. The code can be seen in figure 8, and the circuit in figure 9.

Figure 9: Slideshow of circuit. First image is LED at 0 brightness, second is at half, third is at full.



Comments