2019NHK_teamA / Mbed 2 deprecated Limit_Switch

Dependencies:   mbed

Committer:
st17099ng
Date:
Thu Apr 25 07:58:41 2019 +0000
Revision:
0:fdcc47f2da83
test;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
st17099ng 0:fdcc47f2da83 1 #include "mbed.h"
st17099ng 0:fdcc47f2da83 2
st17099ng 0:fdcc47f2da83 3 DigitalIn Limits[] = {
st17099ng 0:fdcc47f2da83 4 DigitalIn(A2),
st17099ng 0:fdcc47f2da83 5 DigitalIn(A3),
st17099ng 0:fdcc47f2da83 6 DigitalIn(D2),
st17099ng 0:fdcc47f2da83 7 DigitalIn(D3)
st17099ng 0:fdcc47f2da83 8 };
st17099ng 0:fdcc47f2da83 9
st17099ng 0:fdcc47f2da83 10 DigitalOut led(LED1);
st17099ng 0:fdcc47f2da83 11 Serial pc(USBTX,USBRX);
st17099ng 0:fdcc47f2da83 12
st17099ng 0:fdcc47f2da83 13 int main()
st17099ng 0:fdcc47f2da83 14 {
st17099ng 0:fdcc47f2da83 15 Limits[0].mode(PullUp);
st17099ng 0:fdcc47f2da83 16 Limits[1].mode(PullUp);
st17099ng 0:fdcc47f2da83 17 Limits[2].mode(PullUp);
st17099ng 0:fdcc47f2da83 18 Limits[3].mode(PullUp);
st17099ng 0:fdcc47f2da83 19 while (1) {
st17099ng 0:fdcc47f2da83 20 pc.printf("\033[2J\033[1;1H limit1_%c",(Limits[0] == 1)? 'F':'T');
st17099ng 0:fdcc47f2da83 21 pc.printf("\033[2;1H limit2_%c",(Limits[1] == 1)? 'F':'T');
st17099ng 0:fdcc47f2da83 22 pc.printf("\033[3;1H limit3_%c",(Limits[2] == 1)? 'F':'T');
st17099ng 0:fdcc47f2da83 23 pc.printf("\033[4;1H limit4_%c",(Limits[3] == 1)? 'F':'T');
st17099ng 0:fdcc47f2da83 24 wait(0.1);
st17099ng 0:fdcc47f2da83 25 }
st17099ng 0:fdcc47f2da83 26 }