Lab 3: Using a Microcontroller to Generate and Measure Signals
Here are some overall points we learned in this lab:
1. Read code for missing brackets, semicolons, inappropriate use of "float" versus "int," and using "x==y" instead of "x=y."
2. Make sure the ColorPAL is connected appropriately. At one point in the lab, we removed the additional wires and connected the ColorPAL but we connected it backwards. So all of our wiring was in reverse.
3. Obtaining the ranges for which color was which numeric value was done through trial and error.
4. Pseudocode is an effective tool that when used, can ease the process of writing a program.
In this lab, we will have the computer control and receive sensor data through the Arduino. The sensor we will use is the ColorPAL and essentially, the transfer of information will flow as the diagram below describes:
Part 1
The purpose of this part of the lab was to learn how to communicate with the Arduino using the Serial Monitor. The American Standard Code for Information Exchange (ASCII) Chart, part of which is shown below, assigns characters to numbers, and thus the Arduino receives characters as numerical code. We will be using the serial monitor to send characters to the Arduino, which will be caught using the Serial.read() function.
Essentially, we will input a character into the Serial Monitor by typing it into the input box at the top of the window and then click "Send."
We essentially turned the keyboard into a piano, so that if the letter a is pressed, then the A-note will be sounded from the speaker. We referenced Quora for the frequencies assigned to each note from this site.

Here we realized that the Serial.read() function reads characters as number values and also reads one character at a time. We also understood other related functions such as Serial.flush() and Serial.available(). Serial.read() also waits until a character is available so using Serial.available() makes sense because it can check to see if characters are present. Serial.available() can also indicate that characters are present as soon as there are any characters.
Part 2
The ColorPAL we used in the lab appears as this:

Here are some overall points we learned in this lab:
1. Read code for missing brackets, semicolons, inappropriate use of "float" versus "int," and using "x==y" instead of "x=y."
2. Make sure the ColorPAL is connected appropriately. At one point in the lab, we removed the additional wires and connected the ColorPAL but we connected it backwards. So all of our wiring was in reverse.
3. Obtaining the ranges for which color was which numeric value was done through trial and error.
4. Pseudocode is an effective tool that when used, can ease the process of writing a program.
In this lab, we will have the computer control and receive sensor data through the Arduino. The sensor we will use is the ColorPAL and essentially, the transfer of information will flow as the diagram below describes:
Part 1
The purpose of this part of the lab was to learn how to communicate with the Arduino using the Serial Monitor. The American Standard Code for Information Exchange (ASCII) Chart, part of which is shown below, assigns characters to numbers, and thus the Arduino receives characters as numerical code. We will be using the serial monitor to send characters to the Arduino, which will be caught using the Serial.read() function.
Essentially, we will input a character into the Serial Monitor by typing it into the input box at the top of the window and then click "Send."
We essentially turned the keyboard into a piano, so that if the letter a is pressed, then the A-note will be sounded from the speaker. We referenced Quora for the frequencies assigned to each note from this site.
Here we realized that the Serial.read() function reads characters as number values and also reads one character at a time. We also understood other related functions such as Serial.flush() and Serial.available(). Serial.read() also waits until a character is available so using Serial.available() makes sense because it can check to see if characters are present. Serial.available() can also indicate that characters are present as soon as there are any characters.
Part 2
The ColorPAL we used in the lab appears as this:
When it is plugged in properly, it functions like this:

No comments:
Post a Comment