Polling EXAMPLE

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

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 }