Add files via upload

arduino
EmaMaker 2019-01-27 21:57:31 +01:00 committed by GitHub
parent 143da9ed0a
commit 52d3fac821
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 44 additions and 0 deletions

View File

@ -0,0 +1,22 @@
#include <SoftwareSerial.h>
SoftwareSerial mySerial(6, 7); // RX, TX
/**THIS EXAMPLE HAS BEEN SET UP AS MASTER-SLAVE COMMUNICATION, BUT USING mySerial.listen() and mySerial.send() BOTH ARDUINO'S CAN SEND DATA TO THE OTHER**/
void setup() {
// Begin the Serial at 9600 Baud
Serial.begin(9600);
Serial.println("Master arduino ready to send!");
// set the data rate for the SoftwareSerial port
mySerial.begin(57600);
}
void loop() {
mySerial.write('A'); //Write the serial data: A is corrispondent for 65 (ASCII)
delay(1); //bit of delay for the data to be processed
}

View File

@ -0,0 +1,22 @@
#include <SoftwareSerial.h>
SoftwareSerial mySerial(6, 7); // RX, TX
/**THIS EXAMPLE HAS BEEN SET UP AS MASTER-SLAVE COMMUNICATION, BUT USING mySerial.listen() and mySerial.send() BOTH ARDUINO'S CAN SEND DATA TO THE OTHER**/
void setup() {
// Begin the Serial at 9600 Baud
Serial.begin(9600);
Serial.println("Slave Arduino ready to receive!");
// set the data rate for the SoftwareSerial port
mySerial.begin(57600);
}
void loop() {
//prints what the master sent, if data is available
if(mySerial.available() > 0){
Serial.println(mySerial.read());
}
}