wan zhouquan
/
Nucleo_blink_led
遥控
main.cpp
- Committer:
- wanzq
- Date:
- 2017-10-25
- Revision:
- 0:42bec70dc698
File content as of revision 0:42bec70dc698:
#include "mbed.h" DigitalOut myled1(PA_6); DigitalOut myled2(PA_7); DigitalIn sz_n(PB_10),sz_p(PA_5),sx_p(PB_0),sx_n(PB_1),sy_p(PB_3),sy_n(PB_4); AnalogIn L_Y(PA_0),L_X(PA_1),R_Y(PA_2),R_X(PA_3); Serial pc(PA_9,PA_10,9600); int main() { while(1) { if(sz_p==0){ pc.printf("%f",R_Y.read());} if(sz_n ==0){ pc.printf("2");} if(sx_n==0) pc.printf("%F",R_X.read()); if(sx_p==0) pc.printf("%f",L_Y.read()); if(sy_p==0) pc.printf("%f",L_X.read()); if(sy_n==0) pc.printf("6"); // myled1 = 1; // myled2=1; // LED is ON // wait(0.2); // 200 ms // myled2 = 0; // myled1=0; // LED is OFF // wait(1.0); // 1 sec } }