Smartage application

Dependencies:   BufferedSerial SX1276GenericLib USBDeviceHT mbed Crypto X_NUCLEO_IKS01A2

Fork of STM32L0_LoRa by Helmut Tschemernjak

Revision:
22:2c1359292de1
Parent:
21:5d64f9f79190
Child:
24:bb733d746bda
--- a/main.cpp	Tue May 22 21:29:24 2018 +0000
+++ b/main.cpp	Tue May 22 21:33:34 2018 +0000
@@ -25,13 +25,18 @@
     print_stuff();
     
     while(1){
-        //Ultrasonic measurement
-        long distance = sensor.distance();
-        dprintf("distance  %d  \n",distance);
         
         char message[8];//Message to be sent
-        sprintf(message, "%d", distance);
+        get_distance(message);
          
         SendAndBack((uint8_t*)message);
     }
+}
+
+void get_distance(char message[]){
+    //Ultrasonic measurement
+    long distance = sensor.distance();
+    dprintf("distance  %d  \n",distance);
+    
+    sprintf(message, "%d", distance);
 }
\ No newline at end of file