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
Diff: main.cpp
- Revision:
- 8:b5128641d4cf
- Parent:
- 3:6c9f80f5e865
- Child:
- 9:86a5af9935b1
diff -r fb972a5f8a57 -r b5128641d4cf main.cpp --- a/main.cpp Thu Oct 26 16:22:40 2017 +0000 +++ b/main.cpp Thu Oct 26 17:36:52 2017 +0000 @@ -6,7 +6,12 @@ #include "distanceRegulation.h" #include "hcsr04.h" #include "PID.h" +#include "ConfigFile.h" +//TEMP + +ConfigFile _configFile; +LocalFileSystem local("local"); //VARIABLES uint16_t ppmInChannelsValue[CHANNELS]; @@ -29,6 +34,22 @@ wait(1); while(1){ + + /* + // writing to configFile + _configFile.setValue("ahoj", "edo"); + _configFile.write("/local/config.cfg"); + */ + + //reading configFile + _configFile.read("/local/config.cfg"); + char* key = "ahoj"; + char value[BUFSIZ]; + if (_configFile.getValue(key, &value[0], sizeof(value))) + pc.printf("'%s'='%s'\n", key, value); + + + wait(2); Thread::wait(osWaitForever); }