Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bool startCharFound = false;
- int incomingByte = 0;
- String message;
- void readSerial(){
- if (Serial.available() > 0) {
- incomingByte = Serial.read();
- char receivedCharacter = (char) incomingByte;
- if(receivedCharacter == '%'){
- startCharFound = false;
- }
- if(startCharFound == true){
- message += receivedCharacter;
- }
- if(receivedCharacter == '#'){
- startCharFound = true;
- message = "";
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement