RC_reciever
Dependencies: mbed RC_reciever
Revision 2:8c428bae83a8, committed 2015-12-21
- Comitter:
- higedura
- Date:
- Mon Dec 21 02:31:52 2015 +0000
- Parent:
- 1:16b2e229b739
- Commit message:
- RC receiver
Changed in this revision
RC_reciever.lib | Show annotated file Show diff for this revision Revisions of this file |
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/RC_reciever.lib Mon Dec 21 02:31:52 2015 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/higedura/code/RC_reciever/#16b2e229b739
--- a/main.cpp Sat Dec 08 23:52:11 2012 +0000 +++ b/main.cpp Mon Dec 21 02:31:52 2015 +0000 @@ -1,5 +1,4 @@ #include "mbed.h" -#include "TextLCD.h" #define chan 6 // the numbers of channels @@ -9,23 +8,13 @@ DigitalOut led3(LED3); DigitalOut led4(LED4); -Serial xbee(p9,p10); // tx, rx - -InterruptIn ch1(p13); // yaw -InterruptIn ch2(p14); // pitch -InterruptIn ch3(p15); // throttle -InterruptIn ch4(p16); // roll +InterruptIn ch1(p17); // yaw +InterruptIn ch2(p18); // pitch +InterruptIn ch3(p19); // throttle +InterruptIn ch4(p20); // roll //InterruptIn ch5(p17); // aux1 //InterruptIn ch6(p18); // aux2 -/* -InterruptIn ch1(p5); // yaw -InterruptIn ch2(p6); // pitch -InterruptIn ch3(p7); // throttle -InterruptIn ch4(p8); // roll -InterruptIn ch5(p9); // aux1 -InterruptIn ch6(p10); // aux2 -TextLCD lcd(p24, p26, p27, p28, p29, p30); -*/ + void thro_up(); void roll_up(); void pitch_up(); void yaw_up(); void aux1_up(); void aux2_up(); void thro_down(); void roll_down(); void pitch_down(); void yaw_down(); void aux1_down(); void aux2_down(); @@ -37,14 +26,12 @@ int main() { pc.baud(921600); - xbee.baud(115200); - - //lcd.locate(0, 0); lcd.printf("StarBoard Orange"); - //lcd.locate(0, 1); lcd.printf("mbed NXP LPC1768"); - //wait(1); lcd.cls(); - - //xbee.printf("\n\r\n\rRC reciever\n\r"); - + pc.printf("hello!\r\n\r\n"); + led1 =1; + wait(1); + led1 =0; + wait(1); + led1=1; // Reciever function ch1.rise(&yaw_up); ch1.fall(&yaw_down); ch2.rise(&pitch_up); ch2.fall(&pitch_down); @@ -55,19 +42,20 @@ while(1) { - for( int i=0;i<4;i++ ){ xbee.printf("%d ", pwm_pulse[i]); } - xbee.printf("\r\n\r\n"); - - //for( int i=0;i<4;i++ ){ pc.printf("%d ", pwm_pulse[i]); } - //pc.printf("\r\n\r\n"); + for( int i=0;i<4;i++ ){ pc.printf("%d ", pwm_pulse[i]); } + pc.printf("\r\n\r\n"); - //lcd.locate(0, 0); - //lcd.printf("%4d %4d %4d",pwm_pulse[0], pwm_pulse[1], pwm_pulse[2]); - //lcd.locate(0, 1); - //lcd.printf("%4d %4d %4d",pwm_pulse[3], pwm_pulse[4], pwm_pulse[5]); - //lcd.cls(); + //ch1.enable_irq(); + //ch2.enable_irq(); + //ch3.enable_irq(); + //ch4.enable_irq(); wait(.1); + + //ch1.disable_irq(); + //ch2.disable_irq(); + //ch3.disable_irq(); + //ch4.disable_irq(); } }