Skip to content

Instantly share code, notes, and snippets.

@pipoblak
Created June 27, 2017 15:38
Show Gist options
  • Save pipoblak/b0dc8b06a29613c29cb7f8fb0eabfa0a to your computer and use it in GitHub Desktop.
Save pipoblak/b0dc8b06a29613c29cb7f8fb0eabfa0a to your computer and use it in GitHub Desktop.
#include <Arduino.h>
void serialReadCall() {
if (Serial.available() > 0) {
String recivedDataStr = "";
char recivedChar;
while (Serial.available() > 0) {
recivedChar = Serial.read();
if (recivedChar != '\n') {
// Concatena valores
recivedDataStr.concat(recivedChar);
}
}
//Serial.println(recivedDataStr);
if (recivedDataStr.indexOf("$") >= 0) {
Serial.println("Device");
}
}
//FIM EVENTO READ
}
//SETUP INFORMATIONS
void setup() {
Serial.begin(115200);
}
void loop() {
serialReadCall();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment