![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
dd
Dependencies: xtoff2 RF24Network mbed
Fork of xtoff3 by
Diff: Ontvanger.cpp
- Revision:
- 4:7ebc3b421306
- Child:
- 6:6a82110ff393
diff -r e9c4d66da50c -r 7ebc3b421306 Ontvanger.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Ontvanger.cpp Mon Feb 12 16:50:45 2018 +0000 @@ -0,0 +1,32 @@ +#include "Ontvanger.h" + +RF24 radio(spi_MOSI, spi_MISO, spi_SCK, nrf_CE, nrf_CSN ); +RF24Network network(radio); + +RF24NetworkHeader header_rx; + +Ontvanger::Ontvanger() +{ + wait_ms(1000); + radio.begin(); + network.begin(90, this_node); + wait_ms(2000); +}; + +void Ontvanger::update() +{ + network.update(); +} + +bool Ontvanger::available() +{ + return network.available(); +} + +payload_t Ontvanger::read() +{ + payload_t payload_rx; + network.read(header_rx,&payload_rx,sizeof(payload_rx)); + + return payload_rx; +} \ No newline at end of file