This is an example application based on Mbed-OS LoRaWAN protocol APIs. The Mbed-OS LoRaWAN stack implementation is compliant with LoRaWAN v1.0.2 specification.
Dependencies: Lorawan_Version_0_1
Dependents: Lorawan_Version_0_1
Diff: main.cpp
- Revision:
- 62:35d41c8b9419
- Parent:
- 61:2b30d8e75fe7
- Child:
- 63:2bfceda4c30c
diff -r 2b30d8e75fe7 -r 35d41c8b9419 main.cpp --- a/main.cpp Thu Nov 28 15:44:17 2019 +0000 +++ b/main.cpp Tue Dec 03 16:02:12 2019 +0000 @@ -25,6 +25,8 @@ #include "trace_helper.h" #include "lora_radio_helper.h" +#include <mbed.h> + using namespace events; // Max payload size can be LORAMAC_PHY_MAXPAYLOAD. @@ -55,6 +57,7 @@ */ #define PC_9 0 + DigitalOut led(LED2); #include "Fahrrad.h" /** @@ -94,6 +97,9 @@ */ int main(void) { + + + // setup tracing setup_trace(); @@ -158,6 +164,8 @@ uint16_t packet_len; int16_t retcode; int32_t sensor_value; + + if (ds1820.begin()) { ds1820.startConversion(); @@ -213,10 +221,10 @@ if (rx_buffer[0] == 0xa0) Licht_aus(); if (rx_buffer[0] == 0xa1)Licht_an(); - if (rx_buffer[0] == 0xa2) Blinken_ein(); - if (rx_buffer[0] == 0xa3) Blinken_aus() ; + if (rx_buffer[0] == 0xb1) Blinken_ein(); + if (rx_buffer[0] == 0xb0) Blinken_aus() ; - if (rx_buffer[0] == 0xb1)GPS_anfordern(); + if (rx_buffer[0] == 0xc1)GPS_anfordern(); printf("\r\n"); @@ -230,12 +238,11 @@ { switch (event) { case CONNECTED: + led=1; printf("\r\n Connection - Successful \r\n"); - if (MBED_CONF_LORA_DUTY_CYCLE_ON) { - send_message(); - } else { - ev_queue.call_every(TX_TIMER, send_message); - } + + ev_queue.call_every(15000, send_message); + break; case DISCONNECTED: @@ -245,7 +252,7 @@ case TX_DONE: printf("\r\n Message Sent to Network Server \r\n"); if (MBED_CONF_LORA_DUTY_CYCLE_ON) { - send_message(); + //send_message(); } break; case TX_TIMEOUT: