Lab 1: Intro to serial communications
I connected my Arduino, which had two potentiometers and a pushbutton, to the Terminal. Here is the output, which is changing when I change the value of the potentiometer connected to A0 port.
Screen Recording 2021-10-18 at 17.52.03.mov
I then mapped the 0 to 1023 potentiometer output values to 0 to 255.
Screen Recording 2021-10-18 at 18.07.22.mov
When I changed Serial.println()
to Serial.write()
, I got garbage values when I turned the potentiometer.
Screen Recording 2021-10-18 at 18.09.38.mov
I got p5 to read input from my potentiometer, as you can see with the "sensor value" reading.
Screen Recording 2021-10-18 at 19.32.18.mov
I was able to get a graph to work with code in p5, reading the potentiometer output
I was able to get the p5 code to convert any value from the potentiometer into readable output, and here's what the graph looked like when I did so:
Screen Recording 2021-10-20 at 00.43.04.mov
Screen Recording 2021-10-20 at 00.56.51.mov
I was able to get the LED to turn brighter or dimmer by pressing the keys 1 to 9 on the keyboard.
When I dragged the mouse left to right and back, I was able to make the LED brighter and dimmer.