Polling EXAMPLE
Dependencies: mbed
main.cpp
00001 #include "mbed.h" 00002 00003 DigitalOut myled(LED1); 00004 DigitalOut vrefh(D8); 00005 DigitalIn mySw(D15); 00006 Serial pc(USBTX, USBRX); 00007 00008 int main() { 00009 vrefh = 0; 00010 while(1) { 00011 00012 if (mySw == 0) 00013 { 00014 myled = 1; 00015 pc.printf("MY SW IS HIGH\n"); 00016 } 00017 if (mySw == 1) 00018 { 00019 myled = 0; 00020 pc.printf("MY SW IS LOW\n"); 00021 } 00022 } 00023 }
Generated on Sun Jul 17 2022 23:10:40 by 1.7.2