• DinaKhalil

Class 6

Updated: Oct 22, 2019

For this week, we were finally introduced to serial communications. With the help of a P. Comp. session, we used the p5.serialcontrol app to read different values from a potentiometer and a button. The p5.serialcontrol app acts like the serial monitor on the Arduino IDE you can read the values in ascii or binary, but you can’t have both monitors open at the same time. Some notes to keep in mind:

  • When connecting a switch button always connect the resistor to one side of the button to the Arduino pin to the ground!! and for the other switch pin (SAME SIDE)! connect it to the +ive side on the breadboard

  • The higher the baud rate, the faster the numbers come in in the serial monitor

  • There are 8 bits in a byte

9600 bits = 1200.

  • serial.print sends the data as ascii

  • serial.write sends data as binary

  • serial.readString = reads ascii

  • serial.read = reads binary


Picture of Arduino connected to a breadboard and a switch button and a potentiometer


Picture of Arduino connected to a breadboard and a switch button and a potentiometer



Diagram of Arduino connected to a breadboard and a switch button and a potentiometer

Schematics of Arduino connected to a breadboard and a switch button and a potentiometer

I also tried using p5 editor with the Arduino and followed every step. But, guess what?!!!? It doesn't work!! 😁😅😩

I always get this message when I press play:

ws://localhost:8081

Something went wrong with the serial port. undefined



After meeting with David, turns out what I was doing wrong is that I open the port on p5.serial monitor app. So note to self, make sure the p5 serial app is on but not actually opening the port itself!!