File tree Expand file tree Collapse file tree 6 files changed +23
-13
lines changed
examples/04.Communication Expand file tree Collapse file tree 6 files changed +23
-13
lines changed Original file line number Diff line number Diff line change @@ -55,6 +55,7 @@ void loop() {
5555 size(256, 150);
5656
5757 println("Available serial ports:");
58+ // if using Processing 2.1 or later, use Serial.printArray()
5859 println(Serial.list());
5960
6061 // Uses the first port in this list (number 0). Change this to
Original file line number Diff line number Diff line change @@ -63,13 +63,17 @@ void loop() {
6363 size(400, 300);
6464
6565 // List all the available serial ports
66+ // if using Processing 2.1 or later, use Serial.printArray()
6667 println(Serial.list());
68+
6769 // I know that the first port in the serial list on my mac
6870 // is always my Arduino, so I open Serial.list()[0].
6971 // Open whatever port is the one you're using.
7072 myPort = new Serial(this, Serial.list()[0], 9600);
73+
7174 // don't generate a serialEvent() unless you get a newline character:
7275 myPort.bufferUntil('\n');
76+
7377 // set inital background:
7478 background(0);
7579 }
Original file line number Diff line number Diff line change @@ -78,18 +78,19 @@ void loop() {
7878 size(200, 200);
7979 boxX = width/2.0;
8080 boxY = height/2.0;
81- rectMode(RADIUS);
82-
83- // List all the available serial ports in the output pane.
84- // You will need to choose the port that the Arduino board is
85- // connected to from this list. The first port in the list is
86- // port #0 and the third port in the list is port #2.
87- println(Serial.list());
88-
89- // Open the port that the Arduino board is connected to (in this case #0)
90- // Make sure to open the port at the same speed Arduino is using (9600bps)
91- port = new Serial(this, Serial.list()[0], 9600);
92-
81+ rectMode(RADIUS);
82+
83+ // List all the available serial ports in the output pane.
84+ // You will need to choose the port that the Arduino board is
85+ // connected to from this list. The first port in the list is
86+ // port #0 and the third port in the list is port #2.
87+ // if using Processing 2.1 or later, use Serial.printArray()
88+ println(Serial.list());
89+
90+ // Open the port that the Arduino board is connected to (in this case #0)
91+ // Make sure to open the port at the same speed Arduino is using (9600bps)
92+ port = new Serial(this, Serial.list()[0], 9600);
93+
9394 }
9495
9596 void draw()
Original file line number Diff line number Diff line change @@ -92,7 +92,8 @@ void setup() {
9292 xpos = width/2;
9393 ypos = height/2;
9494
95- // Print a list of the serial ports, for debugging purposes:
95+ // Print a list of the serial ports for debugging purposes
96+ // if using Processing 2.1 or later, use Serial.printArray()
9697 println(Serial.list());
9798
9899 // I know that the first port in the serial list on my mac
Original file line number Diff line number Diff line change @@ -91,6 +91,7 @@ void setup() {
9191 size(640,480);
9292
9393 // List all the available serial ports
94+ // if using Processing 2.1 or later, use Serial.printArray()
9495 println(Serial.list());
9596
9697 // I know that the first port in the serial list on my mac
Original file line number Diff line number Diff line change @@ -50,7 +50,9 @@ void loop()
5050 size(200, 200);
5151
5252 // List all the available serial ports
53+ // if using Processing 2.1 or later, use Serial.printArray()
5354 println(Serial.list());
55+
5456 // I know that the first port in the serial list on my mac
5557 // is always my Arduino, so I open Serial.list()[0].
5658 // Open whatever port is the one you're using.
You can’t perform that action at this time.
0 commit comments