Week 6 Physical Computing Lab

Lab: Asynchronous Serial Communications

Preparing the Board

IMG_9091 copy.jpg

ASCII vs. Binary

ASCII-encoded decimal number

Screen Shot 2020-10-22 at 7.11.33 PM.png

Mapped output to a range from 0 - 255

Sending Data in Multiple Formats

Formatted output, printing raw binary value, then the ASCII-encoded binary value, then the ASCII-encoded decimal, hexadecimal, and octal values.

Changing Serial.println() to Serial.write() sends out binary value of the sensor readings.

Screen Shot 2020-10-22 at 7.23.13 PM.png
Screen Shot 2020-10-22 at 7.24.01 PM.png

Values from Sensors

Formatting multiple serial data using punctuation

Sending values for all three sensors

Using the same concept, formatted data from two analog sensors and one digital switch

Screen Shot 2020-10-22 at 7.26.25 PM.png

Flow Control

Using Terminal’s screen

Using Arduino’s Serial Monitor

Screen Shot 2020-10-22 at 7.29.43 PM.png
Screen Shot 2020-10-22 at 7.30.13 PM.png

Lab: Serial Input to P5.js

Preparing the Board

IMG_9099.jpg

Establishing connection using P5.js Serialport Library

Screen Shot 2020-10-22 at 8.58.04 PM.png

Using Serial Event

Drawing Graphs with Sensor Values


Lab: Serial Output from P5.js

Preparing the Board

IMG_9105.jpg

Serial Communication with Numeric Data

Controlling LED with key press 0 through 9

Controlling LED with Mouse Drag

Serial Communication with ASCII-Encoded data

Controlling LED with capital H and L