Pawel Stepien
/
CHR6dm_reading
CHR-6dm trial
Revision 0:e35c4c5a52d6, committed 2011-04-15
- Comitter:
- kinemax
- Date:
- Fri Apr 15 08:04:23 2011 +0000
- Commit message:
Changed in this revision
diff -r 000000000000 -r e35c4c5a52d6 MODSERIAL.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MODSERIAL.lib Fri Apr 15 08:04:23 2011 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/AjK/code/MODSERIAL/#6c9b57c14868
diff -r 000000000000 -r e35c4c5a52d6 PwmIn.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/PwmIn.lib Fri Apr 15 08:04:23 2011 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/simon/code/PwmIn/#6d68eb9b6bbb
diff -r 000000000000 -r e35c4c5a52d6 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Fri Apr 15 08:04:23 2011 +0000 @@ -0,0 +1,80 @@ +// Example PwmIn class to detect PWM inputs, sford +// - Note: uses InterruptIn, so not available on p19/p20 + +#include "mbed.h" +//#include "PwmIn.h" + +#define BAUD 115200 +#define TX_PIN p9 +#define RX_PIN p10 + +#include "MODSERIAL.h" + + DigitalOut led1(LED1); + DigitalOut led2(LED2); + DigitalOut led3(LED3); + DigitalOut led4(LED4); + + MODSERIAL pc(USBTX, USBRX); + MODSERIAL uart(TX_PIN, RX_PIN); + + bool newpacket = false; + +//PwmIn a(p21), b(p22), c(p23), d(p24), e(p25); + +int yaw=0,pitch=0,roll=0, Dyaw=0,Dpitch=0,Droll=0,chk=0; + +int main() +{ char ileB=0,kan1=0,kan2=0; + char zna='0', znak, pakiet[255]="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; + int licz=0; + pc.baud(BAUD); + uart.baud(BAUD); + // uart.attach(&rxCallback, MODSERIAL::RxIrq); + pc.printf("Start\n\r"); + + while(1) + { + if( uart.readable() ); + led1 = 1; // Show start of sending with LED1. + while( (znak=uart.getc())!=115); + { led2 =1; + if(uart.getc()==110) + { + if(uart.getc()==112) + { + if(uart.getc()==0xB7) + { led3=1; + ileB=uart.getc(); + for(int i=0; i<ileB+2; i++) pakiet[i]=uart.getc(); + /* + kan1=uart.getc(); kan2= uart.getc(); + yaw = 256 * (int)uart.getc() + uart.getc(); + pitch = 256 * (int)uart.getc() + uart.getc(); + roll = 256 * (int)uart.getc() + uart.getc(); + chk = 256 * (int)uart.getc() + uart.getc(); + */ + led4=1; led1=0; led2=0; led3=0; + newpacket=1; + //pc.txBufferFlush(); + pc.printf("\n\r N = %2d, NoBytes: ", ileB); + for(int i=0; i<ileB+2; i++) + pc.printf(" %3d ",pakiet[i]); + wait(1); + } + else pc.printf("No PT"); + } + else pc.printf("No P"); + } + else pc.printf("No N"); + } + + } + + //pc.printf("Kanaly= %5.3f %5.3f %5.3f %5.3f %5.3f\n\r", a.pulsewidth()*1000, a.pulsewidth()*1000, b.pulsewidth()*1000, c.pulsewidth()*1000, d.pulsewidth()*1000, e.pulsewidth()*1000); + //wait(1); + +} + + + // higher than "uart" baud rate below.
diff -r 000000000000 -r e35c4c5a52d6 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Fri Apr 15 08:04:23 2011 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/63bcd7ba4912