Smartage application
Dependencies: BufferedSerial SX1276GenericLib USBDeviceHT mbed Crypto X_NUCLEO_IKS01A2
Fork of STM32L0_LoRa by
Diff: main.cpp
- Revision:
- 19:7763501775e5
- Parent:
- 18:d5527ce82e6b
- Child:
- 20:1557c9d9c183
diff -r d5527ce82e6b -r 7763501775e5 main.cpp --- a/main.cpp Mon Mar 12 15:00:02 2018 +0000 +++ b/main.cpp Thu May 17 09:52:47 2018 +0000 @@ -7,7 +7,8 @@ DigitalOut myled(LED); - +//D12 TRIGGER D11 ECHO +HCSR04 sensor(D12, D11); int main() { #ifdef HELTEC_STM32L4 @@ -20,9 +21,18 @@ * blinking LED means USBSerial detected, waiting for a connect. * It waits up to 30 seconds for a USB terminal connections */ - InitSerial(30*1000, &myled); - dprintf("Welcome to the SX1276GenericLib"); - - dprintf("Starting a simple LoRa PingPong"); - SX1276PingPong(); -} + InitSerial(30*1000, &myled); + dprintf("SMARTAGE"); + + while(1){ + //Ultrasonic measurement + long distance = sensor.distance(); + dprintf("distance %d \n",distance); + + char message[8];//Message to be sent + sprintf(message, "%d", distance); + dump("Check: ", (uint8_t*)message, 8); + + SendAndBack((uint8_t*)message); + } +} \ No newline at end of file