Eduard Medla
/
pwm-output
PPM read and generate
Embed:
(wiki syntax)
Show/hide line numbers
main.cpp
00001 #include "mbed.h" 00002 //#include "PPMOut.h" 00003 #include "PPMIn.h" 00004 00005 00006 //PinName pin(D15); 00007 PinName ppmIn(D14); 00008 //Serial pc(USBTX, USBRX); // tx, rx 00009 00010 // main() runs in its own thread in the OS 00011 // (note the calls to wait below for delays) 00012 int main() { 00013 //pc.printf("main started\r\n"); 00014 00015 //chanels[4] = [1400, 1400, 1400, 1400]; 00016 00017 //uint8_t num_channels = 5; 00018 //uint16_t *ppmIn_channels; 00019 00020 //uint16_t channel_value = 600; 00021 //int channel = 1; 00022 00023 00024 //PpmOut ppmOut (pin, num_channels); 00025 PpmIn ppmIn (ppmIn); 00026 00027 //timer1.start(); 00028 while (true) { 00029 //pc.printf("while loop started\r\n"); 00030 //ppmOut.setChannel(1, 1390); 00031 //ppmOut.setChannel(0, 580); 00032 //ppmOut.setChannel(3, 200); 00033 00034 // read PPM 00035 while(!(ppmIn.state)); 00036 //pc.printf("ppmIn.state is true\r\n"); 00037 ppmIn.state = false; 00038 ppmIn_channels = ppmIn.getPpm(); 00039 //pc.printf("ppmIn_channels returned\r\n"); 00040 00041 //for (int i=0; i<10; i++) 00042 //{ 00043 //pc.printf("Channel %d has value %d\r\n", 0, *ppmIn_channels); 00044 //} 00045 00046 //ppmOut.setChannel(1, 1390); 00047 00048 00049 } 00050 } 00051
Generated on Wed Jul 27 2022 06:35:13 by 1.7.2