contain lorawan with serial_rx enabled
Dependencies: pulga-lorawan-drv SPI_MX25R Si1133 BME280
Diff: main.cpp
- Revision:
- 63:4ec1808fb547
- Parent:
- 62:89df9529dbb0
- Child:
- 64:ed68ddac6360
--- a/main.cpp Fri Feb 26 17:07:12 2021 +0000 +++ b/main.cpp Fri Feb 26 18:11:06 2021 +0000 @@ -28,6 +28,7 @@ //#include "BME280.h" #include "serial.h" +#include "gps.h" using namespace events; @@ -110,8 +111,8 @@ mbed::DigitalOut _alive_led(P1_13, 0); mbed::DigitalOut _actuated_led(P1_14,1); -int lat=0; -int lon=0; +//int lat=0; +//int lon=0; int latitude=0; int longitude=0; @@ -119,7 +120,7 @@ //Temperature, Pressure, Humidity Sensor #include "BME280.txt" #include "BMX160.txt" -#include "gps.txt" +//#include "gps.txt" void BMX160Read (void) { @@ -161,14 +162,14 @@ void GPS_Read(void) { gps_print_local(); - pc.printf ("gps longitude=%d \n",lon); - pc.printf ("gps latitude=%d \n",lat); + pc.printf ("gps longitude=%d \n",get_longitude()); + pc.printf ("gps latitude=%d \n",get_latitude()); if(lat!=0 && lon!=0){ - longitude=lon; - latitude=lat; + longitude=get_longitude(); + latitude=get_latitude(); // led1 = !led1; - } - } + } +} void serial_rx(){ if(pc.readable()){ @@ -310,7 +311,7 @@ int32_t sensor_value; gps_print_local(); - packet_len = sprintf((char *) tx_buffer, "%2.2f, %04.2f, %2.2f, %d, %d\n", getTemperature(), getPressure(), getHumidity(), lon, lat); + packet_len = sprintf((char *) tx_buffer, "%2.2f, %04.2f, %2.2f, %d, %d\n", getTemperature(), getPressure(), getHumidity(), get_longitude(), get_latitude()); retcode = lorawan.send(MBED_CONF_LORA_APP_PORT, tx_buffer, packet_len, MSG_UNCONFIRMED_FLAG); @@ -330,8 +331,8 @@ pc.printf("%2.2f;%04.2f;%2.2f;", getTemperature(), getPressure(), getHumidity()); BMX160Read(); - pc.printf ("%d;",lon); - pc.printf ("%d \r\n",lat); + pc.printf ("%d;",get_longitude()); + pc.printf ("%d \r\n",get_latitude()); // printf("\r\n %d bytes scheduled for transmission \r\n", retcode); memset(tx_buffer, 0, sizeof(tx_buffer)); }