From 017326acc6dc95d95c84e7e1290ee47028a99175 Mon Sep 17 00:00:00 2001 From: Scott Fitzgerald Date: Wed, 29 Jan 2014 14:27:09 +0400 Subject: [PATCH] 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 --- build/shared/examples/04.Communication/Dimmer/Dimmer.ino | 1 + build/shared/examples/04.Communication/Graph/Graph.ino | 4 ++++ .../examples/04.Communication/PhysicalPixel/PhysicalPixel.ino | 1 + .../SerialCallResponse/SerialCallResponse.ino | 3 ++- .../SerialCallResponseASCII/SerialCallResponseASCII.ino | 1 + .../04.Communication/VirtualColorMixer/VirtualColorMixer.ino | 2 ++ 6 files changed, 11 insertions(+), 1 deletion(-) diff --git a/build/shared/examples/04.Communication/Dimmer/Dimmer.ino b/build/shared/examples/04.Communication/Dimmer/Dimmer.ino index 78849c2c9..bbd27a8e5 100644 --- a/build/shared/examples/04.Communication/Dimmer/Dimmer.ino +++ b/build/shared/examples/04.Communication/Dimmer/Dimmer.ino @@ -55,6 +55,7 @@ void loop() { size(256, 150); println("Available serial ports:"); + // if using Processing 2.1 or later, use Serial.printArray() println(Serial.list()); // Uses the first port in this list (number 0). Change this to diff --git a/build/shared/examples/04.Communication/Graph/Graph.ino b/build/shared/examples/04.Communication/Graph/Graph.ino index c2e4637b6..58c89994f 100644 --- a/build/shared/examples/04.Communication/Graph/Graph.ino +++ b/build/shared/examples/04.Communication/Graph/Graph.ino @@ -63,13 +63,17 @@ void loop() { size(400, 300); // List all the available serial ports + // if using Processing 2.1 or later, use Serial.printArray() println(Serial.list()); + // I know that the first port in the serial list on my mac // is always my Arduino, so I open Serial.list()[0]. // Open whatever port is the one you're using. myPort = new Serial(this, Serial.list()[0], 9600); + // don't generate a serialEvent() unless you get a newline character: myPort.bufferUntil('\n'); + // set inital background: background(0); } diff --git a/build/shared/examples/04.Communication/PhysicalPixel/PhysicalPixel.ino b/build/shared/examples/04.Communication/PhysicalPixel/PhysicalPixel.ino index 7ac8231a6..6204e09fe 100644 --- a/build/shared/examples/04.Communication/PhysicalPixel/PhysicalPixel.ino +++ b/build/shared/examples/04.Communication/PhysicalPixel/PhysicalPixel.ino @@ -84,6 +84,7 @@ void loop() { // You will need to choose the port that the Arduino board 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. + // if using Processing 2.1 or later, use Serial.printArray() println(Serial.list()); // Open the port that the Arduino board is connected to (in this case #0) diff --git a/build/shared/examples/04.Communication/SerialCallResponse/SerialCallResponse.ino b/build/shared/examples/04.Communication/SerialCallResponse/SerialCallResponse.ino index dc004c9b2..11691ef8b 100644 --- a/build/shared/examples/04.Communication/SerialCallResponse/SerialCallResponse.ino +++ b/build/shared/examples/04.Communication/SerialCallResponse/SerialCallResponse.ino @@ -92,7 +92,8 @@ void setup() { xpos = width/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()); // I know that the first port in the serial list on my mac diff --git a/build/shared/examples/04.Communication/SerialCallResponseASCII/SerialCallResponseASCII.ino b/build/shared/examples/04.Communication/SerialCallResponseASCII/SerialCallResponseASCII.ino index 3c6f94ed2..d8c94956f 100644 --- a/build/shared/examples/04.Communication/SerialCallResponseASCII/SerialCallResponseASCII.ino +++ b/build/shared/examples/04.Communication/SerialCallResponseASCII/SerialCallResponseASCII.ino @@ -91,6 +91,7 @@ void setup() { size(640,480); // List all the available serial ports + // if using Processing 2.1 or later, use Serial.printArray() println(Serial.list()); // I know that the first port in the serial list on my mac diff --git a/build/shared/examples/04.Communication/VirtualColorMixer/VirtualColorMixer.ino b/build/shared/examples/04.Communication/VirtualColorMixer/VirtualColorMixer.ino index 39e4b5761..6a2cd1908 100644 --- a/build/shared/examples/04.Communication/VirtualColorMixer/VirtualColorMixer.ino +++ b/build/shared/examples/04.Communication/VirtualColorMixer/VirtualColorMixer.ino @@ -50,7 +50,9 @@ void loop() size(200, 200); // List all the available serial ports + // if using Processing 2.1 or later, use Serial.printArray() println(Serial.list()); + // I know that the first port in the serial list on my mac // is always my Arduino, so I open Serial.list()[0]. // Open whatever port is the one you're using.