AT219 Arduino Uno Programming (Lab 4)

Before this lab, I assembled my Arduino board by soldering the components via online instructions. Once the Arduino board was complete, I plugged it into my computer via a USB-C cable. From here we were able to write code to the Arduino.

Hello World pt 1
The first thing I coded was for the Arduino board to print "Hello World" on the serial monitor. I also added comments to explain what each line did. The code for this is shown below.


Hello World pt 2
The second thing we coded for the Arduino was to print "Hello World!" on a loop, printing on a new line every time. This utilized the "println" command so it would print on a new line.



Blink
I then built a circuit onto the Arduino using a breadboard, wire, LED light, and a resistor. The goal was to program the Arduino to make the LED light blink in a SOS pattern. This is three short blinks, three long blinks, and then three short blinks again. We can control when the LED turns on or off by controlling the voltage to the LED light. High voltage turns the light on, and low voltage turns the light off. I also needed to add wait commands so that it would produce a high or low voltage for a certain amount of time.


Analog input pt 1
Next, I set up a circuit with a potentiometer and an LED on the Arduino board and wrote a code to write what the potentiometer value is in the serial monitor window. When we move the potentiometer, it changes how much resistance is in the circuit, and it will produce a different readout. We utilize the analog read function and the serialprintln command to print what the potentiometer value is.




Analog input pt 2
We then used the analogwrite function to use the potentiometer to control how much voltage was sent to the LED light to vary its brightness. This changes its functions from on and off, to be able to control the exact brightness.






Comments

Popular posts from this blog

UAS Teardown: 3D printed Motor Mount Final Product

Criminal Location Search (AT309 Week 11)

AT209 Lab 5 Wind Speed vs Battery Life Measurement