#include #include #include // ZA TESTIRANJE Uno RECEIVE RF24 radio(2, 7); // (9, 10); // CE, CSN const byte address[6] = "00001"; boolean button_state = 0; int led = 3; int sig = 4; 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); //You can set this as minimum or maximum depending on the distance between the transmitter and receiver. 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") { digitalWrite(led, HIGH); delay(250); digitalWrite(led, LOW); delay(250); } if(dane == "Z") { digitalWrite(sig, HIGH); delay(250); digitalWrite(sig, LOW); delay(250); } } } -------------------------------------------------------------- #include #include #include // ZA TESTIRANJE Uno SEND RF24 radio(2, 7); // (9, 10); // CE, CSN const byte address[6] = "00001"; //Byte of array representing the address. This is the address where we will send the data. This should be same on the receiving side. int button_pin0 = 0; int button_pin = 1; 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 radio.setPALevel(RF24_PA_MAX); //You can set it as minimum or maximum depending on the distance between the transmitter and receiver. 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 } /*else { const char text[] = "D"; radio.write(&text, sizeof(text)); //Sending the message to receiver } //radio.write(&button_state, sizeof(button_state)); //Sending the message to receiver */ delay(500); }