643 shaares
10 liens privés
10 liens privés
while (Serial.available()<9) {} // Wait 'till there are 9 Bytes waiting
for(int n=0; n<9; n++)
RFin_bytes[n] = Serial.read(); // Then: Get them.
//zoomkat 9-9-10 simple delimited ',' string parce
//from serial port input (via serial monitor)
//and print result out serial port
// CR/LF could also be a delimiter
String readString;
void setup() {
Serial.begin(9600);
}
void loop() {
//expect a string like wer,qwe rty,123 456,hyre kjhg,
//or like hello world,who are you?,bye!,
while (Serial.available()) {
delay(1); //small delay to allow input buffer to fill
char c = Serial.read(); //gets one byte from serial buffer
if (c == ',') {break;} //breaks out of capture loop to print readstring
readString += c; //makes the string readString
}
if (readString.length() >0) {
Serial.println(readString); //prints string to serial port out
//do stuff here
readString=""; //clears variable for new input
}
}