Week 6 - Lab Documentations

This week is about connection and relations between Arduino system and p5.js, and by exchanging the data throughout one and each other, it opened possibilities to give access for us to control digital system by physical things.

︎Lab: Intro to Asynchronous Serial Communications:

“The Serial.write()command doesn’t format the bytes as ASCII characters. It sends out the binary value of the sensor reading. - So, for example, if the sensor reading’s value is 234, then the Serial.write() command sends the binary value 11101010. If the reading is 255, then Serial.write() sends 11111111.”

        For example, imagine that analogValue = 32:
  • Serial.println(mappedValue) results in “32” with a linefeed and carriage return
  • Serial.write(mappedValue) results in ” “, the space character, which has the ASCII value 32.

        -Formatting Multiple Serial Data: Punctuation

        -Flow Control: Call and Response (Handshaking)

︎Lab: Serial Input to P5.js

The process of connection between p5.js and arduino was a bit of confusing that I am not very sure about the relations between the codes that run in arduino, and the codes that run in p5.js, for example, if I uploaded “PhysicalPixels” codes to the uno board, I am not very sure about the correct sequence that should I open the p5.serialcontrol first, and then uploaded the codes or should I do it the other way around?
        -Serial Events

        -Adding A Serial Port Select Menu

            -Draw a Graph With the Sensor Values

︎Lab: Serial output from p5.js

Because the key is already a single character, P5.js sends it out as is, and Arduino reads it as a single byte, looking for the ASCII value of H or L.