Work in progress...

Dependencies:   ESC FreeIMU mbed-rtos mbed

Experiment - work in progress...

main.cpp

Committer:
MatteoT
Date:
2013-07-19
Revision:
1:acb2e0f9d1bc
Parent:
0:22b18227d29e
Child:
2:7439607ccd51

File content as of revision 1:acb2e0f9d1bc:

#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 = 0.5;
        
        //finally output to ESCs
        esc1();
        esc2();
        esc3();
        esc4();
        
        Thread::wait(15);
    }
}