Week 7: Oct 26, 2022

Lab: Intro to Asynchronous Serial Communications

Initializing CommunicationSend the data in many formats
Send the values for all three sensors

Formatting Multiple Serial Data: Punctuation

Flow Control: Call and Response (Handshaking)
Punctuation helps keep your data in order, but because asynchronous serial communication is asynchronous, you can run into a problem when the sender sends faster than the receiver can read.  When this happens, the receiver program slows down as the serial buffer fills up. You can manage this by implementing some form of flow control.

Program the Microcontroller
*Only one port at a time can access a serial port.

Reading Incoming Serial Data

Draw a Graph With the Sensor Values


at serial monitor write ‘a’ or bb’ command enter to check if the LED blinks of Arduino 

send a aaaaaa

aaa and then 3333

Ascii Table
creating text number between number 0~255.
number 65 = A
number 66 = B
number 10 = new line
numbr 15 = space?

BBBBBBBBBBBBBBBBBBBBBBBB ( bite binary to number)
- try serial.write(66)

serial.println ( line )

p5 example

p5js + potentiometer +arduino code
p5js link: https://editor.p5js.org/jm8785/sketches/3lmE_6ETr new code(better version- no error): https://editor.p5js.org/jm8785/sketches/YOMLK-F2b

some code refined

P5 and Arduino sketches for sending 1 value in ascii from Arduino to P5 P5 -> ARDUINO
P5 and Arduino sketches for sending 1 byte binary from P5 to Arduino