Simple data sending to test operability of the radio.
Fork of Sensornode_temp by
main.cpp
- Committer:
- Makodan
- Date:
- 2018-05-03
- Revision:
- 0:49273053c399
- Child:
- 1:bd92b3ee97c1
File content as of revision 0:49273053c399:
#include "mbed.h" #include "config.h" #include "RF24.h" #include "WakeUp.h" #include "Dht11.h" DigitalOut myled(ledpin); Dht11 sensor(RXD); RF24 radio(spi_MOSI, spi_MISO, spi_SCK, nrf_CE, nrf_CSN ); const int hb = 9999; void RadioSetup(); int main(){ int s; int temp = 0; myled=1; RadioSetup(); radio.stopListening(); myled=0; while(1){ WakeUp::set_ms(5000); myled=1; deepsleep(); myled=0; sensor.read(); temp=getCelsius(); radio.powerUp(); radio.write(&temp, 4); radio.powerDown(); } } void RadioSetup(){ radio.begin(); radio.setPALevel(RF24_PA_LOW); radio.setChannel(RadioChannel); radio.setRetries(0,2); radio.enableDynamicAck(); radio.enableDynamicPayloads(); radio.openWritingPipe(DataAddress); }