mbed official
/
PortIn_HelloWorld
PortIn Hello World
Embed:
(wiki syntax)
Show/hide line numbers
main.cpp
00001 // Switch on an LED if any of mbed pins 21-26 is high 00002 00003 #include "mbed.h" 00004 00005 PortIn p(Port2, 0x0000003F); // p21-p26 00006 DigitalOut ind(LED4); 00007 00008 int main() { 00009 while(1) { 00010 int pins = p.read(); 00011 if(pins) { 00012 ind = 1; 00013 } else { 00014 ind = 0; 00015 } 00016 } 00017 }
Generated on Tue Jul 12 2022 11:12:17 by 1.7.2