/* Serial BUS example with switching Tx mode */ #include #define txPin 5 // PB2(RXD) These pins are routed vice-versa on board, so that #define rxPin 4 // PB3(TXD) it can communicate with FTDI cable/programmer etc. SoftwareSerial mySerial(rxPin, txPin); // RX, TX const char node = '3'; // network address const int ledPin = 10; // the number of the LED pin int incomingByte; void setup() { mySerial.begin(9600); pinMode(ledPin, OUTPUT); pinMode(txPin, INPUT); } void loop() { if (mySerial.available() > 0) { digitalWrite(ledPin, HIGH); delay(200); digitalWrite(ledPin, LOW); delay(200); incomingByte = mySerial.read(); if (incomingByte == node) { digitalWrite(ledPin, HIGH); pinMode(txPin, OUTPUT); // open line to write mySerial.print("node "); mySerial.println(node); pinMode(txPin, INPUT); delay(200); digitalWrite(ledPin, LOW); } } }