#include #include #include // TESTING Mega-F5 board SEND RF24 radio(15, 14); // (9, 10); // CE, CSN //Byte of array representing the address. //This is the address where we will send the data. //This should be same on the receiving side. const byte address[6] = "00001"; int button_pin0 = A0; int button_pin = A1; boolean button_state0 = 0; boolean button_state = 0; void setup() { pinMode(button_pin0, INPUT); pinMode(button_pin, INPUT); radio.begin(); //Starting the Wireless communication radio.openWritingPipe(address); //Setting the address where we will send the data //You can set it as minimum or maximum depending on the distance between the transmitter and receiver. radio.setPALevel(RF24_PA_MIN); // RF24_PA_MAX radio.stopListening(); //This sets the module as transmitter } void loop() { button_state0 = digitalRead(button_pin0); button_state = digitalRead(button_pin); if(button_state == LOW) { const char text[] = "Z"; radio.write(&text, sizeof(text)); //Sending the message to receiver } if(button_state0 == LOW) { const char text[] = "C"; radio.write(&text, sizeof(text)); //Sending the message to receiver } delay(500); } ----------------------------------------------------------------------------- #include #include #include // TESTING MEGA-F5 board RECEIVE RF24 radio(15, 14); // (9, 10); // CE, CSN const byte address[6] = "00001"; //Byte of array representing the address. boolean button_state = 0; int led = 4; int sig = 5; String dane = ""; void setup() { pinMode(led, OUTPUT); pinMode(sig, OUTPUT); Serial.begin(9600); radio.begin(); radio.openReadingPipe(0, address); //Setting the address at which we will receive the data radio.setPALevel(RF24_PA_MIN); //RF24_PA_MAX - minimum or maximum depending on the distance radio.startListening(); //This sets the module as receiver } void loop() { if (radio.available()) //Looking for the data. { char text[1] = ""; //Saving the incoming data radio.read(&text, sizeof(text)); //Reading the data dane = String(text[0]); Serial.println(dane); if(dane == "C") { Serial.println("C"); digitalWrite(led, HIGH); delay(250); digitalWrite(led, LOW); delay(250); } if(dane == "Z") { Serial.println("Z"); digitalWrite(sig, HIGH); delay(250); digitalWrite(sig, LOW); delay(250); } } }