/* Group Sofware Serial Bridge LED code Crosses RX and TX compared to nodes. Starts by resetting all IDS by sending 0. Sends the ID over the serial port, waits two seconds, second the second ID. This code is based on the work of Cody Bradly at http://www.ernstc.dk/arduino/tinycom.html and on the SoftwareSerialExample Tom Igoe Date 2019-04-25 Author Joey van der Bie */ #include const int RX = 1; const int TX = 0; //const int SLAVENODES = 2; SoftwareSerial mySerial(RX, TX); int received = 0; const int LED_PIN = 7; void setup() { pinMode(RX, INPUT); pinMode(TX, OUTPUT); mySerial.begin(9600); // declare the LED pin as an OUTPUT: pinMode(LED_PIN, OUTPUT); } void loop() { // if ( mySerial.available() ) { // received = mySerial.parseInt(); // // mySerial.println(received); // // digitalWrite(LED_PIN, HIGH); // delay(100); // digitalWrite(LED_PIN, LOW); // if (received < SLAVENODES) { // // count up to next node // received = received + 1; // mySerial.print(received); // } else { // //reset all lights // mySerial.print(0); // delay(2000); // //turn on light 1 // mySerial.print(1); // delay(2000); // mySerial.print(2); // } // } //reset all lights digitalWrite(LED_PIN, HIGH); delay(50); digitalWrite(LED_PIN, LOW); mySerial.print(0); delay(2000); //turn on light 1 digitalWrite(LED_PIN, HIGH); delay(50); digitalWrite(LED_PIN, LOW); mySerial.print(1); delay(2000); //turn on light 2 digitalWrite(LED_PIN, HIGH); delay(50); digitalWrite(LED_PIN, LOW); mySerial.print(2); delay(2000); }