Read several IOs of a port at the same time.

Dependencies:   mbed

Committer:
bcostm
Date:
Fri Feb 21 12:42:41 2014 +0000
Revision:
0:f7c4107b448c
Child:
1:a33d077656dc
Initial version.

Who changed what in which revision?

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