This week’s lab we went over how to exchange multiple outputs in serial communication. For this week we are plugging two analog senors into the Arduino, along with one digital switch.
There are a few thing additional things from last week’s serial communication lab.
Firstly, we are now exploring how the Arduino and computer interprets binary data and displaying information.
There are essentially three different modes in which the data is being used/displayed.
The computer sends binary data to the Arduino in 1′s and 0′s. The micro controller reads it as binary, but by default translates it into ASCII decimals, and displays them as ASCII characters. For example, your computer sends the number “3″ to your Arduino in binary form “11″. The Arduino reads this binary and turns it into ASCII decimal representation, which is 51. Then it displays the number “3″ after translating “51″ into ASCII character representation.
We’ve also added a buffer so that we know when to call a serialEvent, or as in when for processing to read from the serial connection. In this case, we are telling the program to read every time the buffer has 10 bytes in it.
We do this by adding the line “bufferUntil(__)” in the code.
We also learned two different methods of reading serial information, either by the punctuation method, where we can read the information continuously, and stops where to stop with an indicator such as a punctuation. Another method is done by sending one piece information at a time, and only sending a new data when Processing requests it.