Work in progress...
Dependencies: ESC FreeIMU mbed-rtos mbed
Experiment - work in progress...
Diff: main.cpp
- Revision:
- 0:22b18227d29e
- Child:
- 1:acb2e0f9d1bc
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Fri Jul 19 03:29:42 2013 +0000 @@ -0,0 +1,46 @@ +#include <stdint.h> +#include "mbed.h" +#include "SharedObject.h" +#include "RefRX.h" +#include "esc.h" + +namespace SharedResources +{ + SharedObject <uint32_t> ref1 (0); + SharedObject <uint32_t> ref2 (0); + SharedObject <uint32_t> ref3 (0); + SharedObject <uint32_t> ref4 (0); + SharedObject <float> integration_time (0); +}; + + +int main() +{ + //Setup ESCs + ESC esc1(p26); + ESC esc2(p27); + ESC esc3(p28); + ESC esc4(p29); + + //Setup RefRX static class for remote control + RefRX::init(2222, 2223, &SharedResources::ref1, &SharedResources::ref2, &SharedResources::ref3, &SharedResources::ref4); + + + //Begins main control loop + while(1) { + + + //compute new ESC values.. + + //set it + esc1.setThrottle(0.5); + + //finally output to ESCs + esc1.pulse(); + esc2.pulse(); + esc3.pulse(); + esc4.pulse(); + + Thread::wait(15); + } +}