void setup() {
Serial.begin(9600);
}
uint32_t timer = millis();
void loop() {
uint16_t randNumber = random(65535);
if (millis() - timer > 1000) {
timer = millis();
sender.
addPayload(&randNumber,
sizeof(randNumber));
Serial.print("original number:");
Serial.println(randNumber);
bool ok = test.
write(&sender);
if (ok) {
Serial.println("Send OK");
} else {
Serial.println("Send Failed");
}
}
uint16_t actual;
Serial.print("received number:");
Serial.println(actual);
}
}
bool read(packet *_packet)
Definition rf24g.cpp:150
bool write(packet *_packet)
Definition rf24g.cpp:122
bool available()
Definition rf24g.cpp:117
bool readPayload(void *data, const uint8_t size)
Definition rf24g.cpp:48
void setAddress(uint8_t _address)
Definition rf24g.cpp:20
bool addPayload(const void *data, const uint8_t size)
Definition rf24g.cpp:36
A simple interface for the RF24 radio that abstracts thmr20's Driver.