Objective
This first lab focused on setting up and becoming familiar with the Arduino IDE and the Artemis board that are being used for this class.
Blink
The first part of the lab was running the Blink example program on the board. This program repeatedly toggled an LED once every second. This behavior can be seen in the first section (titled Blink) of the video above.
Serial
The second part of the lab was running the Serial example program on the board. As you can see in the second part (Serial) of the video above, this program prints whatever is typed into the Serial input to the output. In the video, I input "a", "b", and "ece5160 says hi!", which one can see printed out at the bottom of the screen.
AnalogRead
The third part of the lab was running the AnalogRead example program on the board, which was one of the Apollo3 examples. This program reads analog voltages from various inputs; specifically, it reads the following ADC values:
- the ADC reading of a selected ADC pin
- the internal die temperature
- the internal VCC voltage
- the internal VSS voltage
For this lab, I only looked at the temperature reading. While this program did fade the built-in LED according to the temperature reading, I found that just using my hand to vary the temperature was not enought to cause a visible fade. Instead, one can see in the serial monitor of section three (AnalogRead) of the above video that the temp(counts) reading changes. Initially, it is in the region of ~33300 with my hand placed on the board. As I remove my hand, the raw temperature reading gradually falls until it reaches ~33150.
Microphone Output
The final part of this lab was to run the microphone output example. This program used the pulse density microphone (PDM) to detect frequencies from the microphone input. The serial monitor then printed out the frequency with the largest magnitude. In the section of the video titled Microphone Output, I hummed two notes at approximately 183 Hz and 274 Hz which was then displayed on the serial monitor.
As a 5000-level student, I also wrote a brief snippet of code that turned on the onboard LED when it detected the musical note A. I referenced the pitch of an A4, which is 440Hz. However, based on experimentation, I discovered that playing an A4 from my tuner app into the Microphone Output example resulted in the serial monitor printing 434Hz instead. Thus, I made sure to account for the entire range from 434Hz to 440Hz. The code that I implemented is below.
if (ui32LoudestFrequency >= 434 && ui32LoudestFrequency <= 440){
digitalWrite(LED_BUILTIN, HIGH);
}
else {
digitalWrite(LED_BUILTIN, LOW);
}
As one can see, if the frequency of the loudest pitch was within the range for an A4, I turned the LED on; otherwise it was off. This can be seen in action in the last section of the video above. By playing the A, the blue builtin LED turns on. As a note, the LED flickers slightly, probably due to the piano A not being a pure tone.