Advertisement
Guest User

String Serial Simples (by Eduardo Silva)

a guest
Dec 8th, 2015
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.42 KB | None | 0 0
  1. String comando;
  2.  
  3. void setup (){
  4.   Serial.begin(9600);
  5. }
  6. void loop(){
  7.  
  8.   if(Serial.available()) {
  9.  
  10.     while (Serial.available()>0){
  11.       char serial = Serial.read();      
  12.       comando += serial; // monta a string com cada caracter escrito na serial
  13.       delay(10);
  14.     }
  15.   }
  16.  
  17.  if(comando == "55441")
  18.  {
  19.    Serial.println("Recebeu 55441");
  20.  }
  21.  
  22.   comando = ""; // limpa a string
  23.  
  24.   delay(100);
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement