PROGRAMA EMISOR |
// Emisor #include <SoftwareSerial.h> int contador; char VARI[100]; SoftwareSerial mySerial(10, 11); // RX, TX void setup() { Serial.begin(9600); Serial.println("setup EMISOR"); mySerial.begin(28800); } void loop() { digitalWrite(13, true); sprintf(VARI,"PRUEBA DE TRANSMISION Hola mundo %d \n",contador); mySerial.println(VARI); digitalWrite(13, false); Serial.print("SEND="); Serial.println(contador); delay(1000); contador++; } |
PROGRAMA RECEPTOR |
// Receptor #include <SoftwareSerial.h> int contador; char VARI[100]; SoftwareSerial mySerial(10, 11); // RX, TX void setup() { Serial.begin(9600); Serial.println("setup RECEPTOR"); mySerial.begin(28800); } void loop() // run over and over { while (mySerial.available() > 0) { digitalWrite(13, true); char c = mySerial.read(); Serial.print(c); } digitalWrite(13, false); } |