Read several IOs of a port at the same time.

Dependencies:   mbed

Committer:
svastm
Date:
Fri Apr 29 14:33:59 2016 +0000
Revision:
1:a33d077656dc
Parent:
0:f7c4107b448c
Switch ios to PA_5 and PA_7

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bcostm 0:f7c4107b448c 1 #include "mbed.h"
svastm 1:a33d077656dc 2
svastm 1:a33d077656dc 3 #define IOS (0xA0) // PA_5 + PA_7
bcostm 0:f7c4107b448c 4
svastm 1:a33d077656dc 5 PortIn myIOs(PortA, IOS);
bcostm 0:f7c4107b448c 6
bcostm 0:f7c4107b448c 7 DigitalOut myled(LED1);
bcostm 0:f7c4107b448c 8
bcostm 0:f7c4107b448c 9 int main() {
svastm 1:a33d077656dc 10 while(1) {
svastm 1:a33d077656dc 11 if (myIOs.read() != IOS) { // Any of the 2 IOs is low
svastm 1:a33d077656dc 12 myled = !myled; // Toggle LED state
svastm 1:a33d077656dc 13 wait(0.2);
svastm 1:a33d077656dc 14 }
bcostm 0:f7c4107b448c 15 }
bcostm 0:f7c4107b448c 16 }
bcostm 0:f7c4107b448c 17