ArduinoArduino UnoExact chip

Two Unos by radio (nRF24)

Each Uno has an nRF24L01+ (RF24). Board 1 sends its button 20 times a second to address "00001"; board 2 listens there and lights its LED while the button is held. The radios hear each other: same channel, data rate and address.

Two Unos by radio (nRF24) in Argynix Lab

The code

sketch.inoC++
// Board 1, the transmitter: sends its button (pin 2) to address "00001" 20 times a second.
#include <SPI.h>
#include <RF24.h>

RF24 radio(7, 8);  // CE, CSN
const byte address[6] = "00001";

void setup() {
  Serial.begin(9600);
  pinMode(2, INPUT_PULLUP);
  if (!radio.begin()) Serial.println("The radio does not answer: check its wiring");
  radio.openWritingPipe(address);
  radio.setPALevel(RF24_PA_MIN);
  radio.stopListening();
}

void loop() {
  byte pressed = digitalRead(2) == LOW;
  bool ok = radio.write(&pressed, sizeof(pressed));
  static byte was = 2;
  if (pressed != was) {
    Serial.print(pressed ? "Pressed" : "Released");
    Serial.println(ok ? ", board 2 has it" : ", nobody acknowledged");
    was = pressed;
  }
  delay(50);
}