1
0
mirror of https://github.com/arduino/Arduino.git synced 2024-12-01 12:24:14 +01:00

Minor changes to Communication Examples

Added a note to the included Processing sketches about replacing
println(Serial.list()) with Serial.printArray() if using Processing 2.1
or later
This commit is contained in:
Scott Fitzgerald 2014-01-29 14:27:09 +04:00
parent a432e26861
commit 017326acc6
6 changed files with 11 additions and 1 deletions

View File

@ -55,6 +55,7 @@ void loop() {
size(256, 150); size(256, 150);
println("Available serial ports:"); println("Available serial ports:");
// if using Processing 2.1 or later, use Serial.printArray()
println(Serial.list()); println(Serial.list());
// Uses the first port in this list (number 0). Change this to // Uses the first port in this list (number 0). Change this to

View File

@ -63,13 +63,17 @@ void loop() {
size(400, 300); size(400, 300);
// List all the available serial ports // List all the available serial ports
// if using Processing 2.1 or later, use Serial.printArray()
println(Serial.list()); println(Serial.list());
// I know that the first port in the serial list on my mac // I know that the first port in the serial list on my mac
// is always my Arduino, so I open Serial.list()[0]. // is always my Arduino, so I open Serial.list()[0].
// Open whatever port is the one you're using. // Open whatever port is the one you're using.
myPort = new Serial(this, Serial.list()[0], 9600); myPort = new Serial(this, Serial.list()[0], 9600);
// don't generate a serialEvent() unless you get a newline character: // don't generate a serialEvent() unless you get a newline character:
myPort.bufferUntil('\n'); myPort.bufferUntil('\n');
// set inital background: // set inital background:
background(0); background(0);
} }

View File

@ -84,6 +84,7 @@ void loop() {
// You will need to choose the port that the Arduino board is // You will need to choose the port that the Arduino board is
// connected to from this list. The first port in the list is // connected to from this list. The first port in the list is
// port #0 and the third port in the list is port #2. // port #0 and the third port in the list is port #2.
// if using Processing 2.1 or later, use Serial.printArray()
println(Serial.list()); println(Serial.list());
// Open the port that the Arduino board is connected to (in this case #0) // Open the port that the Arduino board is connected to (in this case #0)

View File

@ -92,7 +92,8 @@ void setup() {
xpos = width/2; xpos = width/2;
ypos = height/2; ypos = height/2;
// Print a list of the serial ports, for debugging purposes: // Print a list of the serial ports for debugging purposes
// if using Processing 2.1 or later, use Serial.printArray()
println(Serial.list()); println(Serial.list());
// I know that the first port in the serial list on my mac // I know that the first port in the serial list on my mac

View File

@ -91,6 +91,7 @@ void setup() {
size(640,480); size(640,480);
// List all the available serial ports // List all the available serial ports
// if using Processing 2.1 or later, use Serial.printArray()
println(Serial.list()); println(Serial.list());
// I know that the first port in the serial list on my mac // I know that the first port in the serial list on my mac

View File

@ -50,7 +50,9 @@ void loop()
size(200, 200); size(200, 200);
// List all the available serial ports // List all the available serial ports
// if using Processing 2.1 or later, use Serial.printArray()
println(Serial.list()); println(Serial.list());
// I know that the first port in the serial list on my mac // I know that the first port in the serial list on my mac
// is always my Arduino, so I open Serial.list()[0]. // is always my Arduino, so I open Serial.list()[0].
// Open whatever port is the one you're using. // Open whatever port is the one you're using.