top of page

AT 219 Lab 3 - Introduction to Programming Arduino

johnpkeough
Apr 20, 2025
2 min read

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.

Figure 1: Hello World Part 1
Figure 1: Hello World Part 1

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

Figure 2: Hello World part 2
Figure 2: Hello World part 2

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

Figure 3: BlinkSOS code
Figure 3: BlinkSOS code

Figure 4: BlinkSOS code cont.
Figure 4: BlinkSOS code cont.

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).

Figure 5: Arduino IDE hooked up to debug board
Figure 5: Arduino IDE hooked up to debug board

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.

Figure 6: Potentiometer code
Figure 6: Potentiometer code

Figure 7: Potentiometer circuit.
Figure 7: Potentiometer circuit.

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 8: Potentiometer and LED code
Figure 8: Potentiometer and LED code

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


Comments


Contact me

bottom of page