Eduard Medla
/
pwm-output
PPM read and generate
Diff: main.cpp
- Revision:
- 0:f4a29fdb4d6f
diff -r 000000000000 -r f4a29fdb4d6f main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Fri Jun 09 08:39:37 2017 +0000 @@ -0,0 +1,51 @@ +#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); + + + } +} +