Regenerating PPM signal based on distances from ultrasonic sensors, ESP8266 for connectin via wifi. Autonomous quadcopter behaviour, autonomou height holding. Flying direction based on front and back ultrasonic sensors.

Dependencies:   ConfigFile HCSR04 PID PPM2 mbed-rtos mbed

Revision:
9:86a5af9935b1
Parent:
8:b5128641d4cf
Child:
10:bb9c778f8e3e
--- a/hardware.h	Thu Oct 26 17:36:52 2017 +0000
+++ b/hardware.h	Fri Oct 27 09:09:24 2017 +0000
@@ -25,8 +25,32 @@
 
 HCSR04* _sonic;
 
+ConfigFile _configFile;
+LocalFileSystem local("local");
+char*  _str = new char[1024];
 
+float _P = 0;
+float _I = 0;
+float _D = 0;
 
+void loadConfigFile(void){
+    //reading configFile
+    _configFile.read("/local/config.cfg");
+    char value[BUFSIZ];
+    if (_configFile.getValue("P", &value[0], sizeof(value)))
+        _P = atof(value);
+    if (_configFile.getValue("I", &value[0], sizeof(value)))
+        _I = atof(value);
+    if (_configFile.getValue("D", &value[0], sizeof(value)))
+        _D = atof(value);
+        
+}
+
+//Converts float to char array
+void ConvertToCharArray(float number)
+{
+    sprintf(_str, "%4.2f", number );  
+}
 
 
 #endif
\ No newline at end of file