![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
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:
- 6:c81abfa61bce
- Parent:
- 5:1ad4ca4ee9d8
- Parent:
- 3:6c9f80f5e865
- Child:
- 12:18b31682dfe9
--- a/main.cpp Thu Oct 26 16:15:08 2017 +0000 +++ b/main.cpp Thu Oct 26 16:15:47 2017 +0000 @@ -13,40 +13,27 @@ //FUNCTIONS void print_ppmIn(void); -void dist(int); -//HCSR04 sonic(p6, p7); -//_ppmRegen = new PpmRegen(_interruptPort, _roll, _pitch, _yaw, _throttle, _aux1, _aux2); int main(){ + // INITIALIZE CLASSES _ppmRegen = new PpmRegen(_interruptPort); _sonic = new HCSR04(p29, p30); _groundDistance = new PID(10, 0, 0, 2); + // STARTING THREADS serverThread.start(serverRun); distanceThread.start(distanceRegulationThread); - //_sonic.startUpdates(); wait(1); + while(1){ - //print_ppmIn(); - //_sonic.checkDistance(); - //distance = _sonic.getCurrentDistance(); - //distance = sonic.getDistance(); - //pc.printf("Distance: %d \n\r", distance); - Thread::wait(100); - + Thread::wait(osWaitForever); } } -void dist(int distan) -{ - //pc.printf("Distance: %d \n\r", distan); - distance = distan; -} - void print_ppmIn(){ _ppmRegen->getAllChannels(ppmInChannelsValue); for(uint8_t channel= 0; channel < CHANNELS; channel++){