Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <SoftwareSerial.h>
- SoftwareSerial mySerial(2, 3); // RX, TX
- byte variable[7];
- int index = 0;
- bool printResult = false;
- //----------------------------------------------------------------
- void setup()
- {
- Serial.begin(200);
- mySerial.begin(200);
- }
- //----------------------------------------------------------------
- void loop()
- {
- while (mySerial.available() > 0)
- {
- byte b = mySerial.read();
- variable[index++] = b;
- printResult = true;
- }
- if (printResult == true)
- {
- Serial.print("variable 0: "); Serial.println(variable[0], HEX);
- Serial.print("variable 1: "); Serial.println(variable[1], HEX);
- Serial.print("variable 2: "); Serial.println(variable[2], HEX);
- Serial.print("variable 3 temperatura: "); Serial.println(variable[3], DEC);
- Serial.print("variable 4: "); Serial.println(variable[4], HEX);
- Serial.print("variable 5: "); Serial.println(variable[5], HEX);
- Serial.print("variable 6: "); Serial.println(variable[6], HEX);
- index = 0;
- printResult = false;
- }
- }
Add Comment
Please, Sign In to add comment