-
-
-
-
-
-
- #include <AltSoftSerial.h>
-
- AltSoftSerial altser;
- const int mybaud = 9600;
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- byte sentbyte;
- unsigned long prevmillis;
- byte testbyte=0xF0;
-
- void setup() {
- delay(200);
- Serial.begin(9600);
- while (!Serial) ;
- Serial1.begin(mybaud);
- altser.begin(mybaud);
- Serial.println("AltSoftSerial Receive Test");
- prevmillis = millis();
- }
-
- void loop() {
-
- if (millis() - prevmillis > 250) {
- sentbyte = testbyte++;
- Serial1.write(sentbyte);
- prevmillis = millis();
- }
-
- if (altser.available() > 0) {
- byte b = altser.read();
- Serial.println(b);
- if (b != sentbyte) Serial.println("***** ERROR *****");
- }
- }
|