diff --git a/examples/Analog/AnalogInOutSerial/AnalogInOutSerial.ino b/examples/Analog/AnalogInOutSerial/AnalogInOutSerial.ino index 52707d8..ade3183 100644 --- a/examples/Analog/AnalogInOutSerial/AnalogInOutSerial.ino +++ b/examples/Analog/AnalogInOutSerial/AnalogInOutSerial.ino @@ -38,6 +38,7 @@ void setup() { pinMode(analogInPin, INPUT_ANALOG); // Configure LED pin pinMode(pwmOutPin, PWM); + Serial.begin(115200); // Ignored by Maple. But needed by boards using Hardware serial via a USB to Serial Adaptor } void loop() { @@ -49,8 +50,8 @@ void loop() { pwmWrite(pwmOutPin, outputValue); // print the results to the serial monitor: - SerialUSB.print("sensor = " ); - SerialUSB.print(sensorValue); - SerialUSB.print("\t output = "); - SerialUSB.println(outputValue); + Serial.print("sensor = " ); + Serial.print(sensorValue); + Serial.print("\t output = "); + Serial.println(outputValue); } diff --git a/examples/Analog/AnalogInSerial/AnalogInSerial.ino b/examples/Analog/AnalogInSerial/AnalogInSerial.ino index acdb586..a0b87ca 100644 --- a/examples/Analog/AnalogInSerial/AnalogInSerial.ino +++ b/examples/Analog/AnalogInSerial/AnalogInSerial.ino @@ -22,6 +22,7 @@ const int analogInputPin = 15; void setup() { // Declare analogInputPin as INPUT_ANALOG: pinMode(analogInputPin, INPUT_ANALOG); + Serial.begin(115200); // Ignored by Maple. But needed by boards using Hardware serial via a USB to Serial Adaptor } void loop() { @@ -29,5 +30,5 @@ void loop() { int analogValue = analogRead(analogInputPin); // print the result: - SerialUSB.println(analogValue); + Serial.println(analogValue); } diff --git a/examples/Analog/Smoothing/Smoothing.ino b/examples/Analog/Smoothing/Smoothing.ino index ffaf69b..90f64b2 100644 --- a/examples/Analog/Smoothing/Smoothing.ino +++ b/examples/Analog/Smoothing/Smoothing.ino @@ -24,7 +24,7 @@ const int numReadings = 10; int readings[numReadings]; // the readings from the analog input -int index = 0; // the index of the current reading +int index1 = 0; // the index1 of the current reading int total = 0; // the running total int average = 0; // the average @@ -33,7 +33,8 @@ int inputPin = 15; // analog input pin void setup() { // Declare the input pin as INPUT_ANALOG: pinMode(inputPin, INPUT_ANALOG); - + Serial.begin(115200); // Ignored by Maple. But needed by boards using hardware serial via a USB to Serial adaptor + // Initialize all the readings to 0: for (int thisReading = 0; thisReading < numReadings; thisReading++) { readings[thisReading] = 0; @@ -42,22 +43,22 @@ void setup() { void loop() { // Subtract the last reading: - total = total - readings[index]; + total = total - readings[index1]; // Read from the sensor: - readings[index] = analogRead(inputPin); + readings[index1] = analogRead(inputPin); // Add the reading to the total: - total = total + readings[index]; + total = total + readings[index1]; // Advance to the next position in the array: - index = index + 1; + index1 = index1 + 1; // If we're at the end of the array... - if (index >= numReadings) { + if (index1 >= numReadings) { // ...wrap around to the beginning: - index = 0; + index1 = 0; } // Calculate the average: average = total / numReadings; // Send it to the computer (as ASCII digits) - SerialUSB.println(average, DEC); + Serial.println(average, DEC); } diff --git a/examples/Communication/ASCIITable/ASCIITable.ino b/examples/Communication/ASCIITable/ASCIITable.ino index 53f2293..fc5e5d7 100644 --- a/examples/Communication/ASCIITable/ASCIITable.ino +++ b/examples/Communication/ASCIITable/ASCIITable.ino @@ -1,7 +1,7 @@ /* ASCII table - Connect to the Maple SerialUSB using the Serial Monitor, then press + Connect to the Maple Serial using the Serial Monitor, then press any key and hit enter. Prints out byte values in all possible formats: @@ -25,13 +25,16 @@ by Bryan Newbold */ -void setup() { +void setup() +{ + + Serial.begin(115200); // Ignored by Maple. But needed by boards using hardware serial via a USB to Serial adaptor // Wait for the user to press a key - while (!SerialUSB.available()) + while (!Serial.available()) continue; // Prints title with ending line break - SerialUSB.println("ASCII Table ~ Character Map"); + Serial.println("ASCII Table ~ Character Map"); } // First visible ASCII character: '!' is number 33: @@ -44,29 +47,29 @@ 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 '!' - SerialUSB.print(thisByte, BYTE); + Serial.print(thisByte, BYTE); - SerialUSB.print(", dec: "); + Serial.print(", dec: "); // Prints value as string as an ASCII-encoded decimal (base 10). - // Decimal is the default format for SerialUSB.print() and - // SerialUSB.println(), so no modifier is needed: - SerialUSB.print(thisByte); + // Decimal is the default format for Serial.print() and + // Serial.println(), so no modifier is needed: + Serial.print(thisByte); // But you can declare the modifier for decimal if you want to. // This also works if you uncomment it: - // SerialUSB.print(thisByte, DEC); + // Serial.print(thisByte, DEC); - SerialUSB.print(", hex: "); + Serial.print(", hex: "); // Prints value as string in hexadecimal (base 16): - SerialUSB.print(thisByte, HEX); + Serial.print(thisByte, HEX); - SerialUSB.print(", oct: "); + Serial.print(", oct: "); // Prints value as string in octal (base 8); - SerialUSB.print(thisByte, OCT); + Serial.print(thisByte, OCT); - SerialUSB.print(", bin: "); + Serial.print(", bin: "); // Prints value as string in binary (base 2); also prints ending // line break: - SerialUSB.println(thisByte, BIN); + Serial.println(thisByte, BIN); // If printed last visible character '~' or 126, stop: if (thisByte == 126) { // You could also use if (thisByte == '~') { diff --git a/examples/Communication/Dimmer/Dimmer.ino b/examples/Communication/Dimmer/Dimmer.ino index 45d3462..573783f 100644 --- a/examples/Communication/Dimmer/Dimmer.ino +++ b/examples/Communication/Dimmer/Dimmer.ino @@ -24,6 +24,7 @@ int ledPin = 9; void setup() { + Serial.begin(115200); // Ignored by Maple. But needed by boards using hardware serial via a USB to Serial adaptor // Declare ledPin as an OUTPUT: pinMode(ledPin, OUTPUT); } @@ -32,11 +33,11 @@ void loop() { int brightness; // Check if data has been sent from the computer: - if (SerialUSB.available()) { + if (Serial.available()) { // Read the most recent byte (which will be from 0 to 255), then // convert it to be between 0 and 65,535, which are the minimum // and maximum values usable for PWM: - brightness = map(SerialUSB.read(), 0, 255, 0, 65535); + brightness = map(Serial.read(), 0, 255, 0, 65535); // Set the brightness of the LED: pwmWrite(ledPin, brightness); } diff --git a/examples/Communication/Graph/Graph.ino b/examples/Communication/Graph/Graph.ino index c0dfe54..679ae66 100644 --- a/examples/Communication/Graph/Graph.ino +++ b/examples/Communication/Graph/Graph.ino @@ -29,13 +29,14 @@ const int analogInPin = 15; void setup() { + Serial.begin(115200); // Ignored by Maple. But needed by boards using hardware serial via a USB to Serial adaptor // Declare pin 15 as an analog input: pinMode(analogInPin, INPUT_ANALOG); } void loop() { // send the value of analog input 15: - SerialUSB.println(analogRead(analogInPin)); + Serial.println(analogRead(analogInPin)); } /* Processing code for this example diff --git a/examples/Communication/PhysicalPixel/PhysicalPixel.ino b/examples/Communication/PhysicalPixel/PhysicalPixel.ino index ca45348..76e72d3 100644 --- a/examples/Communication/PhysicalPixel/PhysicalPixel.ino +++ b/examples/Communication/PhysicalPixel/PhysicalPixel.ino @@ -26,15 +26,16 @@ int incomingByte; // a variable to read incoming serial data into void setup() { + Serial.begin(115200); // Ignored by Maple. But needed by boards using hardware serial via a USB to Serial adaptor // Initialize the built-in LED pin as an output: pinMode(BOARD_LED_PIN, OUTPUT); } void loop() { // See if there's incoming serial data: - if (SerialUSB.available() > 0) { + if (Serial.available() > 0) { // Read the oldest byte in the serial buffer: - incomingByte = SerialUSB.read(); + incomingByte = Serial.read(); // If it's a capital H (ASCII 72), turn on the LED: if (incomingByte == 'H') { digitalWrite(BOARD_LED_PIN, HIGH); diff --git a/examples/Communication/SerialCallResponse/SerialCallResponse.ino b/examples/Communication/SerialCallResponse/SerialCallResponse.ino index 6bcea64..eee35e3 100644 --- a/examples/Communication/SerialCallResponse/SerialCallResponse.ino +++ b/examples/Communication/SerialCallResponse/SerialCallResponse.ino @@ -29,6 +29,7 @@ int thirdSensor = 0; // digital sensor value int inByte = 0; // incoming serial byte void setup() { + Serial.begin(115200); // Ignored by Maple. But needed by boards using hardware serial via a USB to Serial adaptor pinMode(0, INPUT_ANALOG); // First (analog) sensor is on pin 0 pinMode(1, INPUT_ANALOG); // Second (analog) sensor is on pin 1 pinMode(2, INPUT); // Third (digital) sensor is on pin 2 @@ -37,9 +38,9 @@ void setup() { void loop() { // if we get a valid byte, read analog ins: - if (SerialUSB.available() > 0) { + if (Serial.available() > 0) { // get incoming byte: - inByte = SerialUSB.read(); + inByte = Serial.read(); // read first analog input, map it into the range 0-255: firstSensor = map(analogRead(0), 0, 4095, 0, 255); // delay 10 ms to let the ADC value change: @@ -49,15 +50,15 @@ void loop() { // read switch, map it to 0 or 255 thirdSensor = map(digitalRead(2), 0, 1, 0, 255); // send sensor values: - SerialUSB.print(firstSensor, BYTE); - SerialUSB.print(secondSensor, BYTE); - SerialUSB.print(thirdSensor, BYTE); + Serial.print(firstSensor, BYTE); + Serial.print(secondSensor, BYTE); + Serial.print(thirdSensor, BYTE); } } void establishContact() { - while (SerialUSB.available() <= 0) { - SerialUSB.print('A', BYTE); // send a capital A + while (Serial.available() <= 0) { + Serial.print('A', BYTE); // send a capital A delay(300); } } diff --git a/examples/Communication/SerialCallResponseASCII/SerialCallResponseASCII.ino b/examples/Communication/SerialCallResponseASCII/SerialCallResponseASCII.ino index cd73bbb..55add44 100644 --- a/examples/Communication/SerialCallResponseASCII/SerialCallResponseASCII.ino +++ b/examples/Communication/SerialCallResponseASCII/SerialCallResponseASCII.ino @@ -30,6 +30,7 @@ int thirdSensor = 0; // digital sensor int inByte = 0; // incoming serial byte void setup() { + Serial.begin(115200); // Ignored by Maple. But needed by boards using hardware serial via a USB to Serial adaptor pinMode(0, INPUT_ANALOG); // First (analog) sensor is on pin 0 pinMode(1, INPUT_ANALOG); // Second (analog) sensor is on pin 1 pinMode(2, INPUT); // digital sensor is on digital pin 2 @@ -38,9 +39,9 @@ void setup() { void loop() { // if we get a valid byte, read analog ins: - if (SerialUSB.available() > 0) { + if (Serial.available() > 0) { // get incoming byte: - inByte = SerialUSB.read(); + inByte = Serial.read(); // read first analog input, map it into the range 0-255: firstSensor = map(analogRead(0), 0, 4095, 0, 255); // delay 10 ms to let the ADC value change: @@ -50,17 +51,17 @@ void loop() { // read switch, map it to 0 or 255 thirdSensor = map(digitalRead(2), 0, 1, 0, 255); // send sensor values: - SerialUSB.print(firstSensor, DEC); - SerialUSB.print(","); - SerialUSB.print(secondSensor, DEC); - SerialUSB.print(","); - SerialUSB.println(thirdSensor, DEC); + Serial.print(firstSensor, DEC); + Serial.print(","); + Serial.print(secondSensor, DEC); + Serial.print(","); + Serial.println(thirdSensor, DEC); } } void establishContact() { - while (SerialUSB.available() <= 0) { - SerialUSB.println("0,0,0"); // send an initial string + while (Serial.available() <= 0) { + Serial.println("0,0,0"); // send an initial string delay(300); } } diff --git a/examples/Communication/SerialPassthrough/SerialPassthrough.ino b/examples/Communication/SerialPassthrough/SerialPassthrough.ino index 83f140c..71b9e34 100644 --- a/examples/Communication/SerialPassthrough/SerialPassthrough.ino +++ b/examples/Communication/SerialPassthrough/SerialPassthrough.ino @@ -1,10 +1,10 @@ /* Multiple serial test - Receives from Serial1, sends to SerialUSB. + Receives from Serial1, sends to Serial. The circuit: - * Maple connected over SerialUSB + * Maple connected over Serial * Serial device (e.g. an Xbee radio, another Maple) created 30 Dec. 2008 @@ -18,13 +18,14 @@ int inByte; // Byte read from Serial1 void setup() { // Initialize Serial1 - Serial1.begin(9600); + Serial.begin(115200); // Ignored by Maple. But needed by boards using hardware serial via a USB to Serial adaptor + Serial1.begin(115200); } void loop() { - // Read from Serial1, send over USB: + // Read from Serial1, send over USB on Maple (or uses hardware serial 1 and hardware serial 2 on non-maple boards: if (Serial1.available()) { inByte = Serial1.read(); - SerialUSB.print(inByte, BYTE); + Serial.print(inByte, BYTE); } } diff --git a/examples/Communication/VirtualColorMixer/VirtualColorMixer.ino b/examples/Communication/VirtualColorMixer/VirtualColorMixer.ino index 7f134c0..61218ba 100644 --- a/examples/Communication/VirtualColorMixer/VirtualColorMixer.ino +++ b/examples/Communication/VirtualColorMixer/VirtualColorMixer.ino @@ -25,17 +25,18 @@ const int greenPin = 16; // sensor to control green color const int bluePin = 17; // sensor to control blue color void setup() { - pinMode(redPin, INPUT_ANALOG); - pinMode(greenPin, INPUT_ANALOG); - pinMode(bluePin, INPUT_ANALOG); + Serial.begin(115200); // Ignored by Maple. But needed by boards using hardware serial via a USB to Serial adaptor + pinMode(redPin, INPUT_ANALOG); + pinMode(greenPin, INPUT_ANALOG); + pinMode(bluePin, INPUT_ANALOG); } void loop() { - SerialUSB.print(analogRead(redPin)); - SerialUSB.print(","); - SerialUSB.print(analogRead(greenPin)); - SerialUSB.print(","); - SerialUSB.println(analogRead(bluePin)); + Serial.print(analogRead(redPin)); + Serial.print(","); + Serial.print(analogRead(greenPin)); + Serial.print(","); + Serial.println(analogRead(bluePin)); } /* Processing code for this example diff --git a/examples/Control/IfStatementConditional/IfStatementConditional.ino b/examples/Control/IfStatementConditional/IfStatementConditional.ino index 2b7fdf3..3afeeb1 100644 --- a/examples/Control/IfStatementConditional/IfStatementConditional.ino +++ b/examples/Control/IfStatementConditional/IfStatementConditional.ino @@ -28,6 +28,7 @@ const int threshold = 400; // A random threshold level that's in // the range of the analog input void setup() { + Serial.begin(115200); // Ignored by Maple. But needed by boards using hardware serial via a USB to Serial adaptor // Initialize the built-in LED pin as an output: pinMode(BOARD_LED_PIN, OUTPUT); @@ -48,5 +49,5 @@ void loop() { } // Print the analog value: - SerialUSB.println(analogValue, DEC); + Serial.println(analogValue, DEC); } diff --git a/examples/Control/switchCase/switchCase.ino b/examples/Control/switchCase/switchCase.ino index 7a57e75..f1edb25 100644 --- a/examples/Control/switchCase/switchCase.ino +++ b/examples/Control/switchCase/switchCase.ino @@ -27,6 +27,7 @@ const int sensorMin = 0; // sensor minimum, discovered through experiment const int sensorMax = 600; // sensor maximum, discovered through experiment void setup() { + Serial.begin(115200); // Ignored by Maple. But needed by boards using hardware serial via a USB to Serial adaptor pinMode(0, INPUT_ANALOG); } @@ -39,16 +40,16 @@ void loop() { // Do something different depending on the range value: switch (range) { case 0: // your hand is on the sensor - SerialUSB.println("dark"); + Serial.println("dark"); break; case 1: // your hand is close to the sensor - SerialUSB.println("dim"); + Serial.println("dim"); break; case 2: // your hand is a few inches from the sensor - SerialUSB.println("medium"); + Serial.println("medium"); break; case 3: // your hand is nowhere near the sensor - SerialUSB.println("bright"); + Serial.println("bright"); break; } } diff --git a/examples/Control/switchCase2/switchCase2.ino b/examples/Control/switchCase2/switchCase2.ino index 3870f4c..ace8ec8 100644 --- a/examples/Control/switchCase2/switchCase2.ino +++ b/examples/Control/switchCase2/switchCase2.ino @@ -22,6 +22,7 @@ */ void setup() { + Serial.begin(115200); // Ignored by Maple. But needed by boards using hardware serial via a USB to Serial adaptor // Initialize the LED pins: for (int thisPin = 2; thisPin <= 6; thisPin++) { pinMode(thisPin, OUTPUT); @@ -30,8 +31,8 @@ void setup() { void loop() { // Read the sensor: - if (SerialUSB.available() > 0) { - int inByte = SerialUSB.read(); + if (Serial.available() > 0) { + int inByte = Serial.read(); // Do something different depending on the character received. // The switch statement expects single number values for each // case; in this example, though, you're using single quotes diff --git a/examples/Digital/StateChangeDetection/StateChangeDetection.ino b/examples/Digital/StateChangeDetection/StateChangeDetection.ino index fd8a4fb..8c3a39f 100644 --- a/examples/Digital/StateChangeDetection/StateChangeDetection.ino +++ b/examples/Digital/StateChangeDetection/StateChangeDetection.ino @@ -26,6 +26,7 @@ int buttonState = 0; // current state of the button int lastButtonState = 0; // previous state of the button void setup() { + Serial.begin(115200); // Ignored by Maple. But needed by boards using hardware serial via a USB to Serial adaptor // initialize the button pin as a input: pinMode(BOARD_BUTTON_PIN, INPUT); // initialize the LED as an output: @@ -43,14 +44,14 @@ void loop() { // if the current state is HIGH, then the button went from // off to on: buttonPushCounter++; - SerialUSB.println("on"); - SerialUSB.print("number of button pushes: "); - SerialUSB.println(buttonPushCounter, DEC); + Serial.println("on"); + Serial.print("number of button pushes: "); + Serial.println(buttonPushCounter, DEC); } else { // if the current state is LOW, then the button went from // on to off: - SerialUSB.println("off"); + Serial.println("off"); } // save the current state as the last state, for next time diff --git a/examples/Maple/CrudeVGA/CrudeVGA.ino b/examples/Maple/CrudeVGA/CrudeVGA.ino index b515f02..7644686 100644 --- a/examples/Maple/CrudeVGA/CrudeVGA.ino +++ b/examples/Maple/CrudeVGA/CrudeVGA.ino @@ -9,7 +9,7 @@ surely isn't the best way to do VGA video with a Maple, but it demonstrates the Timer functionality and is a cool hack so here it is. - SerialUSB is disabled to get rid of most interrupts (which mess with timing); + Serial is disabled to get rid of most interrupts (which mess with timing); the SysTick is probably the source of the remaining flickers. This means that you have to use perpetual bootloader or the reset button to flash new programs. @@ -88,7 +88,7 @@ uint8 logo[18][16] = { {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,}, }; void setup() { - + Serial.begin(115200); // Ignored by Maple. But needed by boards using hardware serial via a USB to Serial adaptor // Setup our pins pinMode(LED_PIN, OUTPUT); pinMode(VGA_R, OUTPUT); @@ -104,7 +104,7 @@ void setup() { // This gets rid of the majority of the interrupt artifacts; // a SysTick.end() is required as well - SerialUSB.end(); + Serial.end(); // Configure diff --git a/examples/Maple/InteractiveTest/InteractiveTest.ino b/examples/Maple/InteractiveTest/InteractiveTest.ino index 4c7fde1..b3b77b1 100644 --- a/examples/Maple/InteractiveTest/InteractiveTest.ino +++ b/examples/Maple/InteractiveTest/InteractiveTest.ino @@ -2,7 +2,7 @@ Interactive Test Session for LeafLabs Maple Useful for testing Maple features and troubleshooting. - Communicates over SerialUSB. + Communicates over Serial. This code is released into the public domain. */ @@ -21,6 +21,7 @@ const char* dummy_data = ("qwertyuiopasdfghjklzxcvbnmmmmmm,./1234567890-=" // -- setup() and loop() ------------------------------------------------------ void setup() { + Serial.begin(115200); // Ignored by Maple. But needed by boards using hardware serial via a USB to Serial adaptor // Set up the LED to blink pinMode(BOARD_LED_PIN, OUTPUT); @@ -29,20 +30,20 @@ void setup() { Serial2.begin(BAUD); Serial3.begin(BAUD); - // Send a message out over SerialUSB interface - SerialUSB.println(" "); - SerialUSB.println(" __ __ _ _"); - SerialUSB.println(" | \\/ | __ _ _ __ | | ___| |"); - SerialUSB.println(" | |\\/| |/ _` | '_ \\| |/ _ \\ |"); - SerialUSB.println(" | | | | (_| | |_) | | __/_|"); - SerialUSB.println(" |_| |_|\\__,_| .__/|_|\\___(_)"); - SerialUSB.println(" |_|"); - SerialUSB.println(" by leaflabs"); - SerialUSB.println(""); - SerialUSB.println(""); - SerialUSB.println("Maple interactive test program (type '?' for help)"); - SerialUSB.println("----------------------------------------------------------"); - SerialUSB.print("> "); + // Send a message out over Serial interface + Serial.println(" "); + Serial.println(" __ __ _ _"); + Serial.println(" | \\/ | __ _ _ __ | | ___| |"); + Serial.println(" | |\\/| |/ _` | '_ \\| |/ _ \\ |"); + Serial.println(" | | | | (_| | |_) | | __/_|"); + Serial.println(" |_| |_|\\__,_| .__/|_|\\___(_)"); + Serial.println(" |_|"); + Serial.println(" by leaflabs"); + Serial.println(""); + Serial.println(""); + Serial.println("Maple interactive test program (type '?' for help)"); + Serial.println("----------------------------------------------------------"); + Serial.print("> "); } @@ -50,16 +51,16 @@ void loop () { toggleLED(); delay(100); - while (SerialUSB.available()) { - uint8 input = SerialUSB.read(); - SerialUSB.println(input); + while (Serial.available()) { + uint8 input = Serial.read(); + Serial.println(input); switch(input) { case '\r': break; case ' ': - SerialUSB.println("spacebar, nice!"); + Serial.println("spacebar, nice!"); break; case '?': @@ -68,7 +69,7 @@ void loop () { break; case 'u': - SerialUSB.println("Hello World!"); + Serial.println("Hello World!"); break; case 'w': @@ -82,11 +83,11 @@ void loop () { break; case '.': - while (!SerialUSB.available()) { + while (!Serial.available()) { Serial1.print("."); Serial2.print("."); Serial3.print("."); - SerialUSB.print("."); + Serial.print("."); } break; @@ -103,7 +104,7 @@ void loop () { break; case 'W': - while (!SerialUSB.available()) { + while (!Serial.available()) { Serial1.print(dummy_data); Serial2.print(dummy_data); Serial3.print(dummy_data); @@ -111,9 +112,9 @@ void loop () { break; case 'U': - SerialUSB.println("Dumping data to USB. Press any key."); - while (!SerialUSB.available()) { - SerialUSB.print(dummy_data); + Serial.println("Dumping data to USB. Press any key."); + while (!Serial.available()) { + Serial.print(dummy_data); } break; @@ -126,10 +127,10 @@ void loop () { break; case 'f': - SerialUSB.println("Wiggling D4 as fast as possible in bursts. " + Serial.println("Wiggling D4 as fast as possible in bursts. " "Press any key."); pinMode(4, OUTPUT); - while (!SerialUSB.available()) { + while (!Serial.available()) { fast_gpio(4); delay(1); } @@ -140,18 +141,18 @@ void loop () { break; case '_': - SerialUSB.println("Delaying for 5 seconds..."); + Serial.println("Delaying for 5 seconds..."); delay(5000); break; // Be sure to update cmd_print_help() if you implement these: case 't': // TODO - SerialUSB.println("Unimplemented."); + Serial.println("Unimplemented."); break; case 'T': // TODO - SerialUSB.println("Unimplemented."); + Serial.println("Unimplemented."); break; case 's': @@ -159,30 +160,30 @@ void loop () { break; case 'd': - SerialUSB.println("Pulling down D4, D22. Press any key."); + Serial.println("Pulling down D4, D22. Press any key."); pinMode(22, INPUT_PULLDOWN); pinMode(4, INPUT_PULLDOWN); - while (!SerialUSB.available()) { + while (!Serial.available()) { continue; } - SerialUSB.println("Pulling up D4, D22. Press any key."); + Serial.println("Pulling up D4, D22. Press any key."); pinMode(22, INPUT_PULLUP); pinMode(4, INPUT_PULLUP); - while (!SerialUSB.available()) { + while (!Serial.available()) { continue; } - SerialUSB.read(); + Serial.read(); pinMode(4, OUTPUT); break; // Be sure to update cmd_print_help() if you implement these: case 'i': // TODO - SerialUSB.println("Unimplemented."); + Serial.println("Unimplemented."); break; case 'I': // TODO - SerialUSB.println("Unimplemented."); + Serial.println("Unimplemented."); break; case 'r': @@ -202,51 +203,51 @@ void loop () { break; default: // ------------------------------- - SerialUSB.print("Unexpected: "); - SerialUSB.print(input); - SerialUSB.println(", press h for help."); + Serial.print("Unexpected: "); + Serial.print(input); + Serial.println(", press h for help."); } - SerialUSB.print("> "); + Serial.print("> "); } } // -- Commands ---------------------------------------------------------------- void cmd_print_help(void) { - SerialUSB.println(""); - SerialUSB.println("Command Listing"); - SerialUSB.println("\t?: print this menu"); - SerialUSB.println("\th: print this menu"); - SerialUSB.println("\tw: print Hello World on all 3 USARTS"); - SerialUSB.println("\tn: measure noise and do statistics"); - SerialUSB.println("\tN: measure noise and do statistics with background stuff"); - SerialUSB.println("\ta: show realtime ADC info"); - SerialUSB.println("\t.: echo '.' until new input"); - SerialUSB.println("\tu: print Hello World on USB"); - SerialUSB.println("\t_: do as little as possible for a couple seconds (delay)"); - SerialUSB.println("\tp: test all PWM channels sequentially"); - SerialUSB.println("\tW: dump data as fast as possible on all 3 USARTS"); - SerialUSB.println("\tU: dump data as fast as possible on USB"); - SerialUSB.println("\tg: toggle GPIOs sequentially"); - SerialUSB.println("\tG: toggle GPIOs at the same time"); - SerialUSB.println("\tf: toggle pin 4 as fast as possible in bursts"); - SerialUSB.println("\tr: monitor and print GPIO status changes"); - SerialUSB.println("\ts: output a sweeping servo PWM on all PWM channels"); - SerialUSB.println("\tm: output data on USART1 and USART3 with various rates"); - SerialUSB.println("\tb: print information about the board."); - SerialUSB.println("\t+: test shield mode (for quality assurance testing)"); + Serial.println(""); + Serial.println("Command Listing"); + Serial.println("\t?: print this menu"); + Serial.println("\th: print this menu"); + Serial.println("\tw: print Hello World on all 3 USARTS"); + Serial.println("\tn: measure noise and do statistics"); + Serial.println("\tN: measure noise and do statistics with background stuff"); + Serial.println("\ta: show realtime ADC info"); + Serial.println("\t.: echo '.' until new input"); + Serial.println("\tu: print Hello World on USB"); + Serial.println("\t_: do as little as possible for a couple seconds (delay)"); + Serial.println("\tp: test all PWM channels sequentially"); + Serial.println("\tW: dump data as fast as possible on all 3 USARTS"); + Serial.println("\tU: dump data as fast as possible on USB"); + Serial.println("\tg: toggle GPIOs sequentially"); + Serial.println("\tG: toggle GPIOs at the same time"); + Serial.println("\tf: toggle pin 4 as fast as possible in bursts"); + Serial.println("\tr: monitor and print GPIO status changes"); + Serial.println("\ts: output a sweeping servo PWM on all PWM channels"); + Serial.println("\tm: output data on USART1 and USART3 with various rates"); + Serial.println("\tb: print information about the board."); + Serial.println("\t+: test shield mode (for quality assurance testing)"); - SerialUSB.println("Unimplemented:"); - SerialUSB.println("\te: do everything all at once until new input"); - SerialUSB.println("\tt: output a 1khz squarewave on all GPIOs"); - SerialUSB.println("\tT: output a 1hz squarewave on all GPIOs"); - SerialUSB.println("\ti: print out a bunch of info about system state"); - SerialUSB.println("\tI: print out status of all headers"); + Serial.println("Unimplemented:"); + Serial.println("\te: do everything all at once until new input"); + Serial.println("\tt: output a 1khz squarewave on all GPIOs"); + Serial.println("\tT: output a 1hz squarewave on all GPIOs"); + Serial.println("\ti: print out a bunch of info about system state"); + Serial.println("\tI: print out status of all headers"); } void cmd_adc_stats(void) { - SerialUSB.println("Taking ADC noise stats."); + Serial.println("Taking ADC noise stats."); digitalWrite(BOARD_LED_PIN, 0); for (uint32 i = 0; i < BOARD_NR_ADC_PINS; i++) { delay(5); @@ -255,7 +256,7 @@ void cmd_adc_stats(void) { } void cmd_stressful_adc_stats(void) { - SerialUSB.println("Taking ADC noise stats under duress."); + Serial.println("Taking ADC noise stats under duress."); for (uint32 i = 0; i < BOARD_NR_ADC_PINS; i++) { for (uint32 j = 0; j < BOARD_NR_PWM_PINS; j++) { @@ -285,34 +286,34 @@ void cmd_everything(void) { // TODO // print to usb // toggle gpios // enable pwm - SerialUSB.println("Unimplemented."); + Serial.println("Unimplemented."); } void cmd_serial1_serial3(void) { HardwareSerial *serial_1_and_3[] = {&Serial1, &Serial3}; - SerialUSB.println("Testing 57600 baud on USART1 and USART3. " + Serial.println("Testing 57600 baud on USART1 and USART3. " "Press any key to stop."); usart_baud_test(serial_1_and_3, 2, 57600); - SerialUSB.read(); + Serial.read(); - SerialUSB.println("Testing 115200 baud on USART1 and USART3. " + Serial.println("Testing 115200 baud on USART1 and USART3. " "Press any key to stop."); usart_baud_test(serial_1_and_3, 2, 115200); - SerialUSB.read(); + Serial.read(); - SerialUSB.println("Testing 9600 baud on USART1 and USART3. " + Serial.println("Testing 9600 baud on USART1 and USART3. " "Press any key to stop."); usart_baud_test(serial_1_and_3, 2, 9600); - SerialUSB.read(); + Serial.read(); - SerialUSB.println("Resetting USART1 and USART3..."); + Serial.println("Resetting USART1 and USART3..."); Serial1.begin(BAUD); Serial3.begin(BAUD); } void cmd_gpio_monitoring(void) { - SerialUSB.println("Monitoring pin state changes. Press any key to stop."); + Serial.println("Monitoring pin state changes. Press any key to stop."); for (int i = 0; i < BOARD_NR_GPIO_PINS; i++) { if (boardUsesPin(i)) @@ -321,19 +322,19 @@ void cmd_gpio_monitoring(void) { gpio_state[i] = (uint8)digitalRead(i); } - while (!SerialUSB.available()) { + while (!Serial.available()) { for (int i = 0; i < BOARD_NR_GPIO_PINS; i++) { if (boardUsesPin(i)) continue; uint8 current_state = (uint8)digitalRead(i); if (current_state != gpio_state[i]) { - SerialUSB.print("State change on pin "); - SerialUSB.print(i, DEC); + Serial.print("State change on pin "); + Serial.print(i, DEC); if (current_state) { - SerialUSB.println(":\tHIGH"); + Serial.println(":\tHIGH"); } else { - SerialUSB.println(":\tLOW"); + Serial.println(":\tLOW"); } gpio_state[i] = current_state; } @@ -348,44 +349,44 @@ void cmd_gpio_monitoring(void) { } void cmd_sequential_adc_reads(void) { - SerialUSB.print("Sequentially reading most ADC ports."); - SerialUSB.println("Press any key for next port, or ESC to stop."); + Serial.print("Sequentially reading most ADC ports."); + Serial.println("Press any key for next port, or ESC to stop."); for (uint32 i = 0; i < BOARD_NR_ADC_PINS; i++) { if (boardUsesPin(i)) continue; - SerialUSB.print("Reading pin "); - SerialUSB.print(boardADCPins[i], DEC); - SerialUSB.println("..."); + Serial.print("Reading pin "); + Serial.print(boardADCPins[i], DEC); + Serial.println("..."); pinMode(boardADCPins[i], INPUT_ANALOG); - while (!SerialUSB.available()) { + while (!Serial.available()) { int sample = analogRead(boardADCPins[i]); - SerialUSB.print(boardADCPins[i], DEC); - SerialUSB.print("\t"); - SerialUSB.print(sample, DEC); - SerialUSB.print("\t"); - SerialUSB.print("|"); + Serial.print(boardADCPins[i], DEC); + Serial.print("\t"); + Serial.print(sample, DEC); + Serial.print("\t"); + Serial.print("|"); for (int j = 0; j < 4096; j += 100) { if (sample >= j) { - SerialUSB.print("#"); + Serial.print("#"); } else { - SerialUSB.print(" "); + Serial.print(" "); } } - SerialUSB.print("| "); + Serial.print("| "); for (int j = 0; j < 12; j++) { if (sample & (1 << (11 - j))) { - SerialUSB.print("1"); + Serial.print("1"); } else { - SerialUSB.print("0"); + Serial.print("0"); } } - SerialUSB.println(""); + Serial.println(""); } pinMode(boardADCPins[i], OUTPUT); digitalWrite(boardADCPins[i], 0); - if (SerialUSB.read() == ESC) + if (Serial.read() == ESC) break; } } @@ -396,11 +397,11 @@ bool test_single_pin_is_high(int high_pin, const char* err_msg) { if (boardUsesPin(i)) continue; if (digitalRead(i) == HIGH && i != high_pin) { - SerialUSB.println(); - SerialUSB.print("\t*** FAILURE! pin "); - SerialUSB.print(i, DEC); - SerialUSB.print(' '); - SerialUSB.println(err_msg); + Serial.println(); + Serial.print("\t*** FAILURE! pin "); + Serial.print(i, DEC); + Serial.print(' '); + Serial.println(err_msg); ok = false; } } @@ -420,7 +421,7 @@ bool wait_for_low_transition(uint8 pin) { void cmd_gpio_qa(void) { bool all_pins_ok = true; const int not_a_pin = -1; - SerialUSB.println("Doing QA testing for unused GPIO pins."); + Serial.println("Doing QA testing for unused GPIO pins."); for (int i = 0; i < BOARD_NR_GPIO_PINS; i++) { if (boardUsesPin(i)) continue; @@ -428,25 +429,25 @@ void cmd_gpio_qa(void) { pinMode(i, INPUT); } - SerialUSB.println("Waiting to start."); + Serial.println("Waiting to start."); ASSERT(!boardUsesPin(0)); while (digitalRead(0) == LOW) continue; for (int i = 0; i < BOARD_NR_GPIO_PINS; i++) { if (boardUsesPin(i)) { - SerialUSB.print("Skipping pin "); - SerialUSB.println(i, DEC); + Serial.print("Skipping pin "); + Serial.println(i, DEC); continue; } bool pin_ok = true; - SerialUSB.print("Checking pin "); - SerialUSB.print(i, DEC); + Serial.print("Checking pin "); + Serial.print(i, DEC); while (digitalRead(i) == LOW) continue; pin_ok = pin_ok && test_single_pin_is_high(i, "is also HIGH"); if (!wait_for_low_transition(i)) { - SerialUSB.println("Transition to low timed out; something is " + Serial.println("Transition to low timed out; something is " "very wrong. Aborting test."); return; } @@ -454,16 +455,16 @@ void cmd_gpio_qa(void) { pin_ok = pin_ok && test_single_pin_is_high(not_a_pin, "is still HIGH"); if (pin_ok) { - SerialUSB.println(": ok"); + Serial.println(": ok"); } all_pins_ok = all_pins_ok && pin_ok; } if (all_pins_ok) { - SerialUSB.println("Finished; test passes."); + Serial.println("Finished; test passes."); } else { - SerialUSB.println("**** TEST FAILS *****"); + Serial.println("**** TEST FAILS *****"); } for (int i = 0; i < BOARD_NR_GPIO_PINS; i++) { @@ -476,30 +477,30 @@ void cmd_gpio_qa(void) { } void cmd_sequential_gpio_writes(void) { - SerialUSB.println("Sequentially toggling all unused pins. " + Serial.println("Sequentially toggling all unused pins. " "Press any key for next pin, ESC to stop."); for (uint32 i = 0; i < BOARD_NR_GPIO_PINS; i++) { if (boardUsesPin(i)) continue; - SerialUSB.print("Toggling pin "); - SerialUSB.print((int)i, DEC); - SerialUSB.println("..."); + Serial.print("Toggling pin "); + Serial.print((int)i, DEC); + Serial.println("..."); pinMode(i, OUTPUT); do { togglePin(i); - } while (!SerialUSB.available()); + } while (!Serial.available()); digitalWrite(i, LOW); - if (SerialUSB.read() == ESC) + if (Serial.read() == ESC) break; } } void cmd_gpio_toggling(void) { - SerialUSB.println("Toggling all unused pins simultaneously. " + Serial.println("Toggling all unused pins simultaneously. " "Press any key to stop."); for (uint32 i = 0; i < BOARD_NR_GPIO_PINS; i++) { @@ -508,7 +509,7 @@ void cmd_gpio_toggling(void) { pinMode(i, OUTPUT); } - while (!SerialUSB.available()) { + while (!Serial.available()) { for (uint32 i = 0; i < BOARD_NR_GPIO_PINS; i++) { if (boardUsesPin(i)) continue; @@ -524,34 +525,34 @@ void cmd_gpio_toggling(void) { } void cmd_sequential_pwm_test(void) { - SerialUSB.println("Sequentially testing PWM on all unused pins. " + Serial.println("Sequentially testing PWM on all unused pins. " "Press any key for next pin, ESC to stop."); for (uint32 i = 0; i < BOARD_NR_PWM_PINS; i++) { if (boardUsesPin(i)) continue; - SerialUSB.print("PWM out on header D"); - SerialUSB.print(boardPWMPins[i], DEC); - SerialUSB.println("..."); + Serial.print("PWM out on header D"); + Serial.print(boardPWMPins[i], DEC); + Serial.println("..."); pinMode(boardPWMPins[i], PWM); pwmWrite(boardPWMPins[i], 16000); - while (!SerialUSB.available()) { + while (!Serial.available()) { delay(10); } pinMode(boardPWMPins[i], OUTPUT); digitalWrite(boardPWMPins[i], 0); - if (SerialUSB.read() == ESC) + if (Serial.read() == ESC) break; } } void cmd_servo_sweep(void) { - SerialUSB.println("Testing all PWM headers with a servo sweep. " + Serial.println("Testing all PWM headers with a servo sweep. " "Press any key to stop."); - SerialUSB.println(); + Serial.println(); disable_usarts(); init_all_timers(21); @@ -567,7 +568,7 @@ void cmd_servo_sweep(void) { // 1.50ms = 4915counts = 90deg // 1.75ms = 5734counts = 180deg int rate = 4096; - while (!SerialUSB.available()) { + while (!Serial.available()) { rate += 20; if (rate > 5734) rate = 4096; @@ -589,21 +590,21 @@ void cmd_servo_sweep(void) { } void cmd_board_info(void) { // TODO print more information - SerialUSB.println("Board information"); - SerialUSB.println("================="); + Serial.println("Board information"); + Serial.println("================="); - SerialUSB.print("* Clock speed (cycles/us): "); - SerialUSB.println(CYCLES_PER_MICROSECOND); + Serial.print("* Clock speed (cycles/us): "); + Serial.println(CYCLES_PER_MICROSECOND); - SerialUSB.print("* BOARD_LED_PIN: "); - SerialUSB.println(BOARD_LED_PIN); + Serial.print("* BOARD_LED_PIN: "); + Serial.println(BOARD_LED_PIN); - SerialUSB.print("* BOARD_BUTTON_PIN: "); - SerialUSB.println(BOARD_BUTTON_PIN); + Serial.print("* BOARD_BUTTON_PIN: "); + Serial.println(BOARD_BUTTON_PIN); - SerialUSB.print("* GPIO information (BOARD_NR_GPIO_PINS = "); - SerialUSB.print(BOARD_NR_GPIO_PINS); - SerialUSB.println("):"); + Serial.print("* GPIO information (BOARD_NR_GPIO_PINS = "); + Serial.print(BOARD_NR_GPIO_PINS); + Serial.println("):"); print_board_array("ADC pins", boardADCPins, BOARD_NR_ADC_PINS); print_board_array("PWM pins", boardPWMPins, BOARD_NR_PWM_PINS); print_board_array("Used pins", boardUsedPins, BOARD_NR_USED_PINS); @@ -627,14 +628,14 @@ void measure_adc_noise(uint8 pin) { M2 = M2 + delta * (data[i] - mean); } - SerialUSB.print("header: D"); - SerialUSB.print(pin, DEC); - SerialUSB.print("\tn: "); - SerialUSB.print(100, DEC); - SerialUSB.print("\tmean: "); - SerialUSB.print(mean); - SerialUSB.print("\tvariance: "); - SerialUSB.println(M2 / 99.0); + Serial.print("header: D"); + Serial.print(pin, DEC); + Serial.print("\tn: "); + Serial.print(100, DEC); + Serial.print("\tmean: "); + Serial.print(mean); + Serial.print("\tvariance: "); + Serial.println(M2 / 99.0); pinMode(pin, OUTPUT); } @@ -674,7 +675,7 @@ void usart_baud_test(HardwareSerial **serials, int n, unsigned baud) { for (int i = 0; i < n; i++) { serials[i]->begin(baud); } - while (!SerialUSB.available()) { + while (!Serial.available()) { for (int i = 0; i < n; i++) { serials[i]->println(dummy_data); if (serials[i]->available()) { @@ -711,14 +712,14 @@ void disable_usarts(void) { } void print_board_array(const char* msg, const uint8 arr[], int len) { - SerialUSB.print("\t"); - SerialUSB.print(msg); - SerialUSB.print(" ("); - SerialUSB.print(len); - SerialUSB.print("): "); + Serial.print("\t"); + Serial.print(msg); + Serial.print(" ("); + Serial.print(len); + Serial.print("): "); for (int i = 0; i < len; i++) { - SerialUSB.print(arr[i], DEC); - if (i < len - 1) SerialUSB.print(", "); + Serial.print(arr[i], DEC); + if (i < len - 1) Serial.print(", "); } - SerialUSB.println(); + Serial.println(); } diff --git a/examples/Maple/StressSerialUSB/StressSerialUSB.ino b/examples/Maple/StressSerialUSB/StressSerialUSB.ino index bfb44d2..8ea9fe8 100644 --- a/examples/Maple/StressSerialUSB/StressSerialUSB.ino +++ b/examples/Maple/StressSerialUSB/StressSerialUSB.ino @@ -1,8 +1,8 @@ /* - SerialUSB Stress Test + Serial Stress Test Connect via Serial2 (header pins D0 and D1 on the Maple) for the back channel; - otherwise just connect with SerialUSB and press BUT to cycle through (hold + otherwise just connect with Serial and press BUT to cycle through (hold it for at least a second). The output will be pretty cryptic; see inline comments for more info. @@ -28,6 +28,7 @@ uint32 state = 0; void setup() { + Serial.begin(115200); // Ignored by Maple. But needed by boards using hardware serial via a USB to Serial adaptor // Set up the LED to blink pinMode(LED_PIN, OUTPUT); @@ -58,82 +59,82 @@ void loop() { // this pattern makes it easy to see dropped bytes. case QUICKPRINT: for(int i = 0; i<40; i++) { - SerialUSB.print('.'); - SerialUSB.print('|'); + Serial.print('.'); + Serial.print('|'); } - Serial2.println(SerialUSB.pending(),DEC); - SerialUSB.println(); + Serial2.println(Serial.pending(),DEC); + Serial.println(); break; // Send large/log stuff case BIGSTUFF: - SerialUSB.println("01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890"); - SerialUSB.println((uint32)123456789,DEC); - SerialUSB.println(3.1415926535); - Serial2.println(SerialUSB.pending(),DEC); + Serial.println("01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890"); + Serial.println((uint32)123456789,DEC); + Serial.println(3.1415926535); + Serial2.println(Serial.pending(),DEC); break; // Try a bunch of different types and formats case NUMBERS: - SerialUSB.println("Numbers! -----------------------------"); + Serial.println("Numbers! -----------------------------"); Serial2.println("Numbers! -----------------------------"); - SerialUSB.println('1'); + Serial.println('1'); Serial2.println('1'); - SerialUSB.println(1,DEC); + Serial.println(1,DEC); Serial2.println(1,DEC); - SerialUSB.println(-1,DEC); + Serial.println(-1,DEC); Serial2.println(-1,DEC); - SerialUSB.println(3.14159265); + Serial.println(3.14159265); Serial2.println(3.14159265); - SerialUSB.println(3.14159265,9); + Serial.println(3.14159265,9); Serial2.println(3.14159265,9); - SerialUSB.println(123456789,DEC); + Serial.println(123456789,DEC); Serial2.println(123456789,DEC); - SerialUSB.println(-123456789,DEC); + Serial.println(-123456789,DEC); Serial2.println(-123456789,DEC); - SerialUSB.println(65535,HEX); + Serial.println(65535,HEX); Serial2.println(65535,HEX); - SerialUSB.println(65535,OCT); + Serial.println(65535,OCT); Serial2.println(65535,OCT); - SerialUSB.println(65535,BIN); + Serial.println(65535,BIN); Serial2.println(65535,BIN); break; // Very basic prints case SIMPLE: Serial2.println("Trying write('a')"); - SerialUSB.write('a'); + Serial.write('a'); Serial2.println("Trying write(\"b\")"); - SerialUSB.write("b"); + Serial.write("b"); Serial2.println("Trying print('c')"); - SerialUSB.print('c'); + Serial.print('c'); Serial2.println("Trying print(\"d\")"); - SerialUSB.print("d"); + Serial.print("d"); Serial2.println("Trying print(\"efg\")"); - SerialUSB.print("efg"); + Serial.print("efg"); Serial2.println("Trying println(\"hij\\n\\r\")"); - SerialUSB.print("hij\n\r"); - SerialUSB.write(' '); - SerialUSB.println(); + Serial.print("hij\n\r"); + Serial.write(' '); + Serial.println(); Serial2.println("Trying println(123456789,DEC)"); - SerialUSB.println(123456789,DEC); + Serial.println(123456789,DEC); Serial2.println("Trying println(3.141592)"); - SerialUSB.println(3.141592); + Serial.println(3.141592); Serial2.println("Trying println(\"DONE\")"); - SerialUSB.println("DONE"); + Serial.println("DONE"); break; // Disables the USB peripheral, then brings it back up a // few seconds later case ONOFF: Serial2.println("Shutting down..."); - SerialUSB.println("Shutting down..."); - SerialUSB.end(); + Serial.println("Shutting down..."); + Serial.end(); Serial2.println("Waiting 4seconds..."); delay(4000); Serial2.println("Starting up..."); - SerialUSB.begin(); - SerialUSB.println("Hello World!"); + Serial.begin(); + Serial.println("Hello World!"); Serial2.println("Waiting 4seconds..."); delay(4000); state++; diff --git a/examples/Maple/TimerInterrupts/TimerInterrupts.ino b/examples/Maple/TimerInterrupts/TimerInterrupts.ino index ed8c5fd..e973358 100644 --- a/examples/Maple/TimerInterrupts/TimerInterrupts.ino +++ b/examples/Maple/TimerInterrupts/TimerInterrupts.ino @@ -24,6 +24,7 @@ int count2 = 0; void setup() { + Serial.begin(115200); // Ignored by Maple. But needed by boards using hardware serial via a USB to Serial adaptor // Set up the LED to blink pinMode(LED_PIN, OUTPUT); @@ -57,10 +58,10 @@ void setup() void loop() { // Display the running counts - SerialUSB.print("Count 1: "); - SerialUSB.print(count1); - SerialUSB.print("\t\tCount 2: "); - SerialUSB.println(count2); + Serial.print("Count 1: "); + Serial.print(count1); + Serial.print("\t\tCount 2: "); + Serial.println(count2); // Run... while BUT is held, pause Count2 for(int i = 0; i<1000; i++) { diff --git a/examples/Sensors/Knock/Knock.ino b/examples/Sensors/Knock/Knock.ino index 7aa4557..ec68072 100644 --- a/examples/Sensors/Knock/Knock.ino +++ b/examples/Sensors/Knock/Knock.ino @@ -30,6 +30,7 @@ const int threshold = 100; // threshold value to decide when the detected sound int sensorReading = 0; // variable to store the value read from the sensor pin void setup() { + Serial.begin(115200); // Ignored by Maple. But needed by boards using hardware serial via a USB to Serial adaptor // Declare the knockSensor as an analog input: pinMode(knockSensor, INPUT_ANALOG); // declare the built-in LED pin as an output: @@ -45,7 +46,7 @@ void loop() { // toggle the built-in LED toggleLED(); // send the string "Knock!" back to the computer, followed by newline - SerialUSB.println("Knock!"); + Serial.println("Knock!"); } delay(100); // delay to avoid printing too often } diff --git a/examples/Stubs/AnalogReadSerial/AnalogReadSerial.ino b/examples/Stubs/AnalogReadSerial/AnalogReadSerial.ino index 4ca8a8e..1e122f9 100644 --- a/examples/Stubs/AnalogReadSerial/AnalogReadSerial.ino +++ b/examples/Stubs/AnalogReadSerial/AnalogReadSerial.ino @@ -1,10 +1,11 @@ void setup() { + Serial.begin(115200); // Ignored by Maple. But needed by boards using hardware serial via a USB to Serial adaptor pinMode(0, INPUT_ANALOG); } void loop() { int sensorValue = analogRead(0); - SerialUSB.println(sensorValue, DEC); + Serial.println(sensorValue, DEC); } diff --git a/examples/Stubs/DigitalReadSerial/DigitalReadSerial.ino b/examples/Stubs/DigitalReadSerial/DigitalReadSerial.ino index b13516e..0a9a2ea 100644 --- a/examples/Stubs/DigitalReadSerial/DigitalReadSerial.ino +++ b/examples/Stubs/DigitalReadSerial/DigitalReadSerial.ino @@ -1,8 +1,9 @@ void setup() { + Serial.begin(115200); // Ignored by Maple. But needed by boards using hardware serial via a USB to Serial adaptor pinMode(2, INPUT); } void loop() { int sensorValue = digitalRead(2); - SerialUSB.println(sensorValue, DEC); + Serial.println(sensorValue, DEC); } diff --git a/examples/Stubs/HelloWorld/HelloWorld.ino b/examples/Stubs/HelloWorld/HelloWorld.ino index c4cccb3..2604a4d 100644 --- a/examples/Stubs/HelloWorld/HelloWorld.ino +++ b/examples/Stubs/HelloWorld/HelloWorld.ino @@ -1,7 +1,8 @@ void setup() { - + Serial.begin(115200); // Ignored by Maple. But needed by boards using hardware serial via a USB to Serial adaptor } void loop() { - SerialUSB.println("Hello World!"); + Serial.println("Hello World!"); + delay(1000); } diff --git a/examples/pde.txt b/examples/pde.txt deleted file mode 100644 index 20f0a35..0000000 --- a/examples/pde.txt +++ /dev/null @@ -1,29 +0,0 @@ -c:\Users\rclark\Documents\Arduino\hardware\Arduino_STM32\examples\Analog\AnalogInOutSerial\AnalogInOutSerial.pde -c:\Users\rclark\Documents\Arduino\hardware\Arduino_STM32\examples\Analog\AnalogInput\AnalogInput.pde -c:\Users\rclark\Documents\Arduino\hardware\Arduino_STM32\examples\Analog\AnalogInSerial\AnalogInSerial.pde -c:\Users\rclark\Documents\Arduino\hardware\Arduino_STM32\examples\Analog\Calibration\Calibration.pde -c:\Users\rclark\Documents\Arduino\hardware\Arduino_STM32\examples\Analog\Fading\Fading.pde -c:\Users\rclark\Documents\Arduino\hardware\Arduino_STM32\examples\Analog\Smoothing\Smoothing.pde -c:\Users\rclark\Documents\Arduino\hardware\Arduino_STM32\examples\Communication\ASCIITable\ASCIITable.pde -c:\Users\rclark\Documents\Arduino\hardware\Arduino_STM32\examples\Communication\Dimmer\Dimmer.pde -c:\Users\rclark\Documents\Arduino\hardware\Arduino_STM32\examples\Communication\Graph\Graph.pde -c:\Users\rclark\Documents\Arduino\hardware\Arduino_STM32\examples\Communication\MIDI\Midi.pde -c:\Users\rclark\Documents\Arduino\hardware\Arduino_STM32\examples\Communication\PhysicalPixel\PhysicalPixel.pde -c:\Users\rclark\Documents\Arduino\hardware\Arduino_STM32\examples\Communication\SerialCallResponse\SerialCallResponse.pde -c:\Users\rclark\Documents\Arduino\hardware\Arduino_STM32\examples\Communication\SerialCallResponseASCII\SerialCallResponseASCII.pde -c:\Users\rclark\Documents\Arduino\hardware\Arduino_STM32\examples\Communication\SerialPassthrough\SerialPassthrough.pde -c:\Users\rclark\Documents\Arduino\hardware\Arduino_STM32\examples\Communication\VirtualColorMixer\VirtualColorMixer.pde -c:\Users\rclark\Documents\Arduino\hardware\Arduino_STM32\examples\Control\Arrays\Arrays.pde -c:\Users\rclark\Documents\Arduino\hardware\Arduino_STM32\examples\Control\ForLoopIteration\ForLoopIteration.pde -c:\Users\rclark\Documents\Arduino\hardware\Arduino_STM32\examples\Control\IfStatementConditional\IfStatementConditional.pde -c:\Users\rclark\Documents\Arduino\hardware\Arduino_STM32\examples\Control\switchCase\switchCase.pde -c:\Users\rclark\Documents\Arduino\hardware\Arduino_STM32\examples\Control\switchCase2\switchCase2.pde -c:\Users\rclark\Documents\Arduino\hardware\Arduino_STM32\examples\Control\WhileStatementConditional\WhileStatementConditional.pde -c:\Users\rclark\Documents\Arduino\hardware\Arduino_STM32\examples\Digital\Blink\Blink.pde -c:\Users\rclark\Documents\Arduino\hardware\Arduino_STM32\examples\Digital\BlinkWithoutDelay\BlinkWithoutDelay.pde -c:\Users\rclark\Documents\Arduino\hardware\Arduino_STM32\examples\Digital\Button\Button.pde -c:\Users\rclark\Documents\Arduino\hardware\Arduino_STM32\examples\Digital\Debounce\Debounce.pde -c:\Users\rclark\Documents\Arduino\hardware\Arduino_STM32\examples\Digital\StateChangeDetection\StateChangeDetection.pde -c:\Users\rclark\Documents\Arduino\hardware\Arduino_STM32\examples\Display\barGraph\barGraph.pde -c:\Users\rclark\Documents\Arduino\hardware\Arduino_STM32\examples\Display\RowColumnScanning\RowColumnScanning.pde -c:\Users\rclark\Documents\Arduino\hardware\Arduino_STM32\examples\Maple\CrudeVGA\CrudeVGA.pde