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.
main.cpp@0:1313568875d2, 2017-04-21 (annotated)
- Committer:
- tulanthoar
- Date:
- Fri Apr 21 19:52:18 2017 +0000
- Revision:
- 0:1313568875d2
copy of example for reading multiple IOs simultaneously
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| tulanthoar | 0:1313568875d2 | 1 | #include "mbed.h" |
| tulanthoar | 0:1313568875d2 | 2 | |
| tulanthoar | 0:1313568875d2 | 3 | #define IOS (0xA0) // PA_5 + PA_7 |
| tulanthoar | 0:1313568875d2 | 4 | |
| tulanthoar | 0:1313568875d2 | 5 | PortIn myIOs(PortA, IOS); |
| tulanthoar | 0:1313568875d2 | 6 | |
| tulanthoar | 0:1313568875d2 | 7 | DigitalOut myled(LED1); |
| tulanthoar | 0:1313568875d2 | 8 | |
| tulanthoar | 0:1313568875d2 | 9 | int main() { |
| tulanthoar | 0:1313568875d2 | 10 | while(1) { |
| tulanthoar | 0:1313568875d2 | 11 | if (myIOs.read() != IOS) { // Any of the 2 IOs is low |
| tulanthoar | 0:1313568875d2 | 12 | myled = !myled; // Toggle LED state |
| tulanthoar | 0:1313568875d2 | 13 | wait(0.2); |
| tulanthoar | 0:1313568875d2 | 14 | } |
| tulanthoar | 0:1313568875d2 | 15 | } |
| tulanthoar | 0:1313568875d2 | 16 | } |
| tulanthoar | 0:1313568875d2 | 17 |