I am a beginner currently following the exercises in the Arduino starter kit. In the project 'Tweak the Arduino logo' I am getting the following error from the Processing bit:
new Serial(this, Serial.list()[1411], 9600);the number in brackets is typically a number in the range of 0 to 5. 1411 is way out and the casue of your error.
The Serial.list[] is an array with all the com ports. Each element is just a string "COM1", "COM2*, "COM15" (or whatever you have on your machine, and it will something "/dev/tty" on a linux) and you can pas that string direct if you know your com port, like new Serial(this, "COM15", 9600);
I am using a Macbook Pro and you're correct by assuming that my machine returns something like '/dev/tty'. For what I can understand from your explanation, the code should be something like this:
new Serial(this, "/dev/tty", 9600);
Is that correct?
I will try it tonight.
Thank you.
@holmes4 I have contacted the moderator.Thank you for the heads up.
Yes/no --- println(Serial.list());prints a list of all the serial ports that are "active" on your machine.
The Serial.list()[n] is one of the strings, where n=0 is the first, n=1 is the second...
Now in your new Serial call, you can either use the Serial.list()[n] with the correct n-value or use that exact string inside "-quotes.
There is no need to use println(Serial.list());, once you know the port code "/dev/ttyb1" (or whatever yours is) which probably is fixed for a given connection.
(edits to fix a stupid formating error triggered by the processing syntax)