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:
- 67:7bb75ed97500
- Parent:
- 66:a11c79073f1f
- Child:
- 68:41fff9c3fb4f
--- a/main.cpp Tue Jan 14 13:48:39 2020 +0000 +++ b/main.cpp Wed Jan 15 08:37:29 2020 +0000 @@ -46,7 +46,7 @@ -DigitalOut GPSenable(PC_6); +DigitalOut GPSdisable(PC_6); int LiveTick; bool IsLoading; @@ -136,35 +136,24 @@ - GPS_Position current_pos; - - if(LiveTick>10 && LiveTick<<15){ - GPSenable=1;} - else - { + GPSdisable=0; + GPS_Position current_pos; current_pos = GPS_aktiv(); if(LORA_activ) { printf("\n[LORA] Connected\n"); - send_Position_to_Lora(0x11, current_pos); + if (current_pos.Longitude < 0.1) + { + current_pos.Longitude = 50.123; + current_pos.Latitude = 7.456; + } + send_Position_to_Lora(0x01, current_pos); } else { printf("\n[LORA] not Connected\n"); - } - } - - - - - - - - - - - // ev_queue.call_in(5000, LifeTicker); + } } @@ -179,10 +168,12 @@ watchdog.start(30000); uint32_t watchdog_timeout = watchdog.get_timeout(); - printf("Watchdog initialized to %lu ms.\r\n", watchdog_timeout); + printf("Watchdog initialized to %iu ms.\r\n", watchdog_timeout); - ev_queue.call_every(15000,LifeTicker); + ev_queue.call_every(10000,LifeTicker); + + // setup tracing setup_trace(); @@ -329,10 +320,7 @@ if (rx_buffer[0] == 0xa0) Licht_aus(); if (rx_buffer[0] == 0xa1)Licht_an(); if (rx_buffer[0] == 0xb1) Blinken_ein(); - if (rx_buffer[0] == 0xb0) Blinken_aus() ; - - - + if (rx_buffer[0] == 0xb0) Blinken_aus(); if (rx_buffer[0] == 0xc1)GPS_anfordern(); printf("\r\n"); @@ -349,10 +337,6 @@ case CONNECTED: LORA_activ=1; printf("\r\n Connection - Successful \r\n"); - - //ev_queue.call_every(5000, send_message); - - break; case DISCONNECTED: ev_queue.break_dispatch();