start_switch(lpc1768_board)
Dependencies: mbed
Diff: main.cpp
- Revision:
- 0:1a3a624d06a3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Mon Jan 25 07:22:04 2021 +0000 @@ -0,0 +1,82 @@ +#include "mbed.h" + +DigitalIn SW0(p6);//非常停止1でON +DigitalIn SW1(p8); +DigitalIn SW2(p11); +DigitalIn SW3(p12); +DigitalIn SW4(p15); +DigitalIn SW5(p16); +Serial Xbee1(p9, p10,19200); +Serial Xbee2(p13, p14,19200); +Serial Xbee3(p28, p27,19200); + + + +int main() { + SW0.mode(PullUp); + SW1.mode(PullUp); + SW2.mode(PullUp); + SW3.mode(PullUp); + SW4.mode(PullUp); + SW5.mode(PullUp); + + while(1){ + //非常停止 + if(SW0 == 1){ + Xbee1.putc('S'); + Xbee1.putc('T'); + Xbee1.putc('O'); + Xbee1.putc('P'); + Xbee2.putc('S'); + Xbee2.putc('T'); + Xbee2.putc('O'); + Xbee2.putc('P'); + Xbee3.putc('S'); + Xbee3.putc('T'); + Xbee3.putc('O'); + Xbee3.putc('P'); + } + else{ + Xbee1.putc('L'); + Xbee2.putc('L'); + Xbee3.putc('L'); + } + + + if(SW1 == 0){ + Xbee1.putc('A'); + Xbee2.putc('A'); + Xbee3.putc('A'); + wait_ms(10); + } + if(SW2 == 0){ + Xbee1.putc('B'); + Xbee2.putc('B'); + Xbee3.putc('B'); + wait_ms(10); + } + if(SW3 == 0){ + Xbee1.putc('C'); + Xbee2.putc('C'); + Xbee3.putc('C'); + wait_ms(10); + } + if(SW4 == 0){ + Xbee1.putc('D'); + Xbee2.putc('D'); + Xbee3.putc('D'); + wait_ms(10); + } + if(SW5 == 0){ + Xbee1.putc('E'); + Xbee2.putc('E'); + Xbee3.putc('E'); + wait_ms(10); + } + + + + + + } +} \ No newline at end of file