Lab 1

Lab Description


The purpose of this lab is to setup the Arduino IDE for the Artemis nano board. A few example sketches are also uploaded to the board to demonstate it's functionality. The example sketches include blinking the onboard LED, communicating with the board thorugh UART, using the ADC to read the onboard temperature sensor, and measuring frequencies with the onboard mic.

It's worth noting that I am using Arduino 2.0 IDE, rather than 1.8, which has a different serial monitor.





Lab Sections


The first part of this lab involves blinking the onboard LED. This was done by uploading the "Blink" example sketch.





The second part of this lab has us communicate with the board through UART using an example sketch.





The third part of this lab uses the ADC to measure the onboard temperature sensor. This is again done by uploading an example sketch from the Arduino IDE.





The fourth part of this lab makes use of the onboard mic. This program uses a radix fft algorithm to find the loudest frequency, and is demonstrated by whistling at different pitches near the board.





The fifth part of this lab is a continuation of part 4. In this part of the lab, the onboard LED is turned on when I whistle. This was done by measuring the frequency that I normally whistle at in part 4, then adjusting the existing code to check if a frequency near my whistle frequency was heard. The printLoudest(void) function was adjusted to return a uint32_t rather than void, and now returns the calculated loudest frequency rather than just printing it out. The onboard LED is set as an output using pinMode(LED_BUILTIN, OUTPUT). The Logic within the for loop to turn the LED on or off can be seen below.

uint32_t WHISTLE_FREQ_LOW = 1500;
uint32_t WHISTLE_FREQ_HIGH = 1700;
if(freq >= WHISTLE_FREQ_LOW && freq <= WHISTLE_FREQ_HIGH){
  digitalWrite(LED_BUILTIN, HIGH);
}
else{
  digitalWrite(LED_BUILTIN, LOW);
}
Serial.println(freq);