From 6739f20bbf7b3a200239ef877961688cbadee3cb Mon Sep 17 00:00:00 2001 From: "David A. Mellis" Date: Sat, 26 Feb 2011 13:57:41 -0500 Subject: [PATCH] Modifying examples to use Serial.write() instead of Serial.print(BYTE). --- .../examples/4.Communication/ASCIITable/ASCIITable.pde | 2 +- build/shared/examples/4.Communication/MIDI/Midi.pde | 6 +++--- .../4.Communication/MultiSerialMega/MultiSerialMega.pde | 2 +- .../SerialCallResponse/SerialCallResponse.pde | 8 ++++---- libraries/Firmata/examples/EchoString/EchoString.pde | 8 ++++---- .../examples/TextDirection/TextDirection.pde | 2 +- libraries/LiquidCrystal/examples/setCursor/setCursor.pde | 2 +- 7 files changed, 15 insertions(+), 15 deletions(-) diff --git a/build/shared/examples/4.Communication/ASCIITable/ASCIITable.pde b/build/shared/examples/4.Communication/ASCIITable/ASCIITable.pde index 3678836b3..c92b0d023 100644 --- a/build/shared/examples/4.Communication/ASCIITable/ASCIITable.pde +++ b/build/shared/examples/4.Communication/ASCIITable/ASCIITable.pde @@ -38,7 +38,7 @@ void loop() // prints value unaltered, i.e. the raw binary version of the // byte. The serial monitor interprets all bytes as // ASCII, so 33, the first number, will show up as '!' - Serial.print(thisByte, BYTE); + Serial.write(thisByte); Serial.print(", dec: "); // prints value as string as an ASCII-encoded decimal (base 10). diff --git a/build/shared/examples/4.Communication/MIDI/Midi.pde b/build/shared/examples/4.Communication/MIDI/Midi.pde index 3d34a18cc..cdeaeea11 100644 --- a/build/shared/examples/4.Communication/MIDI/Midi.pde +++ b/build/shared/examples/4.Communication/MIDI/Midi.pde @@ -42,8 +42,8 @@ void loop() { // plays a MIDI note. Doesn't check to see that // cmd is greater than 127, or that data values are less than 127: void noteOn(int cmd, int pitch, int velocity) { - Serial.print(cmd, BYTE); - Serial.print(pitch, BYTE); - Serial.print(velocity, BYTE); + Serial.write(cmd); + Serial.write(pitch); + Serial.write(velocity); } diff --git a/build/shared/examples/4.Communication/MultiSerialMega/MultiSerialMega.pde b/build/shared/examples/4.Communication/MultiSerialMega/MultiSerialMega.pde index 788bc908e..684e305bb 100644 --- a/build/shared/examples/4.Communication/MultiSerialMega/MultiSerialMega.pde +++ b/build/shared/examples/4.Communication/MultiSerialMega/MultiSerialMega.pde @@ -28,6 +28,6 @@ void loop() { // read from port 1, send to port 0: if (Serial1.available()) { int inByte = Serial1.read(); - Serial.print(inByte, BYTE); + Serial.write(inByte); } } diff --git a/build/shared/examples/4.Communication/SerialCallResponse/SerialCallResponse.pde b/build/shared/examples/4.Communication/SerialCallResponse/SerialCallResponse.pde index 6f56d9891..e3565152a 100644 --- a/build/shared/examples/4.Communication/SerialCallResponse/SerialCallResponse.pde +++ b/build/shared/examples/4.Communication/SerialCallResponse/SerialCallResponse.pde @@ -52,15 +52,15 @@ void loop() // read switch, map it to 0 or 255L thirdSensor = map(digitalRead(2), 0, 1, 0, 255); // send sensor values: - Serial.print(firstSensor, BYTE); - Serial.print(secondSensor, BYTE); - Serial.print(thirdSensor, BYTE); + Serial.write(firstSensor); + Serial.write(secondSensor); + Serial.write(thirdSensor); } } void establishContact() { while (Serial.available() <= 0) { - Serial.print('A', BYTE); // send a capital A + Serial.print('A'); // send a capital A delay(300); } } diff --git a/libraries/Firmata/examples/EchoString/EchoString.pde b/libraries/Firmata/examples/EchoString/EchoString.pde index 6559ae1c6..e5c4e6fe5 100644 --- a/libraries/Firmata/examples/EchoString/EchoString.pde +++ b/libraries/Firmata/examples/EchoString/EchoString.pde @@ -14,12 +14,12 @@ void stringCallback(char *myString) void sysexCallback(byte command, byte argc, byte*argv) { - Serial.print(START_SYSEX, BYTE); - Serial.print(command, BYTE); + Serial.write(START_SYSEX); + Serial.write(command); for(byte i=0; i