Simple data sending to test operability of the radio.
Fork of Sensornode_temp by
Revision 1:bd92b3ee97c1, committed 2018-05-14
- Comitter:
- Makodan
- Date:
- Mon May 14 08:29:46 2018 +0000
- Parent:
- 0:49273053c399
- Commit message:
- First commit;
Changed in this revision
--- a/DHT11.lib Thu May 03 17:13:20 2018 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -https://mbed.org/users/fossum_13/code/DHT11/#5da6f6de3e42
--- a/WakeUp.lib Thu May 03 17:13:20 2018 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -https://mbed.org/users/Sissors/code/WakeUp/#49ca85e8822f
--- a/config.h Thu May 03 17:13:20 2018 +0000 +++ b/config.h Mon May 14 08:29:46 2018 +0000 @@ -1,14 +1,9 @@ #ifndef CONFIG_H #define CONFIG_H - - -//This header contains calibration data - - - #define RadioChannel 90 - #define DataAddress 0xF0F0F0F0F0 - + #define RadioChannel 0x4C + #define DataAddress 0xF0F0F0F0D2 + #define ledpin PA_8 #define unused_pin PA_1 @@ -25,6 +20,7 @@ #define RXD PA_3 #define TXD PA_2 + #endif
--- a/main.cpp Thu May 03 17:13:20 2018 +0000 +++ b/main.cpp Mon May 14 08:29:46 2018 +0000 @@ -1,45 +1,41 @@ #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(); + wait_ms(1000); myled=0; + int dummy = 1234; while(1){ - WakeUp::set_ms(5000); - myled=1; - deepsleep(); + myled=1; + radio.write(&dummy, 4); + wait_ms(1000); myled=0; - - sensor.read(); - temp=getCelsius(); - radio.powerUp(); - radio.write(&temp, 4); - radio.powerDown(); + wait_ms(1000); } } void RadioSetup(){ radio.begin(); - radio.setPALevel(RF24_PA_LOW); + radio.setPALevel(RF24_PA_MAX); radio.setChannel(RadioChannel); radio.setRetries(0,2); + radio.setDataRate(RF24_2MBPS); radio.enableDynamicAck(); radio.enableDynamicPayloads(); radio.openWritingPipe(DataAddress);