Read the value from the first potentiometer, and print it to the Serial Monitor.
By typing ls -1 /dev/cu.*
in Terminal, I got this:
elodieliu@ElodiedeMBP ~ % ls -1 /dev/cu.*
/dev/cu.Bluetooth-Incoming-Port
/dev/cu.SB200
/dev/cu.usbmodem1201
There were 2 lines at first. Then I plugged the breadboard to my computer and typed againThe third line showed up.
When typing " screen /dev/cu.usbmodem1201 “, rolling numbers appeared, just like in the serial monitor.
Serial.println() formats the value it prints as an ASCII-encoded decimal number.
(I turned the potentiometer to change the number from over 100 to around(below) 1024)
void setup() {
// start serial port at 9600 bps:
Serial.begin(9600);
}
void loop() {
int analogValue = analogRead(A0);
Serial.println(analogValue);
}
^ changing the Serial.println()
to a Serial.write()
< map the output
As I turned the potentiometer, the characters changed.
the raw binary value
the ASCII-encoded binary value
the ASCII-encoded decimal
hexadecimal
octal values