mirror of
https://github.com/esp8266/Arduino.git
synced 2025-07-30 16:24:09 +03:00
Run new astyle formatter against all the examples
This commit is contained in:
@ -1,20 +1,20 @@
|
||||
/*
|
||||
Serial Event example
|
||||
|
||||
|
||||
When new serial data arrives, this sketch adds it to a String.
|
||||
When a newline is received, the loop prints the string and
|
||||
When a newline is received, the loop prints the string and
|
||||
clears it.
|
||||
|
||||
A good test for this is to try it with a GPS receiver
|
||||
that sends out NMEA 0183 sentences.
|
||||
|
||||
|
||||
A good test for this is to try it with a GPS receiver
|
||||
that sends out NMEA 0183 sentences.
|
||||
|
||||
Created 9 May 2011
|
||||
by Tom Igoe
|
||||
|
||||
|
||||
This example code is in the public domain.
|
||||
|
||||
|
||||
http://www.arduino.cc/en/Tutorial/SerialEvent
|
||||
|
||||
|
||||
*/
|
||||
|
||||
String inputString = ""; // a string to hold incoming data
|
||||
@ -30,7 +30,7 @@ void setup() {
|
||||
void loop() {
|
||||
// print the string when a newline arrives:
|
||||
if (stringComplete) {
|
||||
Serial.println(inputString);
|
||||
Serial.println(inputString);
|
||||
// clear the string:
|
||||
inputString = "";
|
||||
stringComplete = false;
|
||||
@ -46,14 +46,14 @@ void loop() {
|
||||
void serialEvent() {
|
||||
while (Serial.available()) {
|
||||
// get the new byte:
|
||||
char inChar = (char)Serial.read();
|
||||
char inChar = (char)Serial.read();
|
||||
// add it to the inputString:
|
||||
inputString += inChar;
|
||||
// if the incoming character is a newline, set a flag
|
||||
// so the main loop can do something about it:
|
||||
if (inChar == '\n') {
|
||||
stringComplete = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user