PPM read and generate

Dependencies:   PPM

main.cpp

Committer:
edy05
Date:
2017-06-09
Revision:
0:f4a29fdb4d6f

File content as of revision 0:f4a29fdb4d6f:

#include "mbed.h"
//#include "PPMOut.h"
#include "PPMIn.h"


//PinName pin(D15);
PinName ppmIn(D14);
//Serial pc(USBTX, USBRX); // tx, rx   

// main() runs in its own thread in the OS
// (note the calls to wait below for delays)
int main() {
    //pc.printf("main started\r\n");
    
    //chanels[4] = [1400, 1400, 1400, 1400];
    
    //uint8_t num_channels = 5;
    //uint16_t *ppmIn_channels;
    
    //uint16_t channel_value = 600;
    //int channel = 1;
    
    
    //PpmOut ppmOut (pin, num_channels);
    PpmIn ppmIn (ppmIn);
    
    //timer1.start();
    while (true) {
        //pc.printf("while loop started\r\n");
        //ppmOut.setChannel(1, 1390);
        //ppmOut.setChannel(0, 580);
        //ppmOut.setChannel(3, 200);
        
        // read PPM
        while(!(ppmIn.state));
        //pc.printf("ppmIn.state is true\r\n");
        ppmIn.state = false;
        ppmIn_channels = ppmIn.getPpm();
        //pc.printf("ppmIn_channels returned\r\n");
        
        //for (int i=0; i<10; i++)
        //{
        //pc.printf("Channel %d has value %d\r\n", 0, *ppmIn_channels);        
        //}
            
        //ppmOut.setChannel(1, 1390);
        
        
    }
}