Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
main.cpp@0:fdcc47f2da83, 2019-04-25 (annotated)
- Committer:
- st17099ng
- Date:
- Thu Apr 25 07:58:41 2019 +0000
- Revision:
- 0:fdcc47f2da83
test;
Who changed what in which revision?
| User | Revision | Line number | New 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 | } |