mbed official
/
PortIn_HelloWorld
PortIn Hello World
mbed 2 and mbed OS 5
This is an mbed 2 example. For an mbed-os example, please see:
Import programPortIn_HelloWorld
PortIn Hello World
main.cpp
- Committer:
- mbed_official
- Date:
- 2013-02-12
- Revision:
- 0:92064442fd12
File content as of revision 0:92064442fd12:
// Switch on an LED if any of mbed pins 21-26 is high #include "mbed.h" PortIn p(Port2, 0x0000003F); // p21-p26 DigitalOut ind(LED4); int main() { while(1) { int pins = p.read(); if(pins) { ind = 1; } else { ind = 0; } } }