char* DevBot::receber() { int counter=0; limpaComando(); #ifdef ARDUINO_LINUX if(Serial1.available()>0) { while(Serial1.available()>0) // loop through all but the last { char c = Serial1.read(); // receive byte as a character delay(1); comando[counter++]=c; } comando[counter]='\0'; return comando; } else if(Serial.available()>0) { while(Serial.available()>0) // loop through all but the last { char c = Serial.read(); // receive byte as a character delay(1); comando[counter++]=c; } comando[counter]='\0'; return comando; } #else while(Serial.available()>0) // loop through all but the last { char c = Serial.read(); // receive byte as a character //delay(1); comando[counter++]=c; } comando[counter]='\0'; return comando; #endif }
char* DevBot::receber() { int counter=0; limpaComando(); while(Serial.available()>0) // loop through all but the last { char c = Serial.read(); // receive byte as a character delay(1); comando[counter++]=c; } comando[counter]='\0'; return comando; }