This is a simple program that flashes lights on the MBED LPC1768
Embed:
(wiki syntax)
Show/hide line numbers
main.cpp
00001 #include "mbed.h" 00002 /* This program flashes lights on the MBED */ 00003 00004 /* Define some useful constants */ 00005 #define ON 1 00006 #define OFF 0 00007 00008 /* Create names for lights */ 00009 DigitalOut light1(LED1); /* Control LED1 using light1 */ 00010 DigitalOut light2(LED2); /* Control LED2 using light2 */ 00011 00012 // Main loop 00013 int main() 00014 { 00015 /* Define a while loop that runs forever (or until the MBED is reset) */ 00016 while(1) 00017 { 00018 light1=ON; /* Switch light 1 on */ 00019 light2=OFF; /* Switch light2 off */ 00020 wait(0.1); /* Pause for 0.1 seconds (= 100 milliseconds) */ 00021 light1=OFF; 00022 light2=ON; 00023 wait(0.1); 00024 } 00025 }
Generated on Mon Aug 15 2022 21:18:51 by
1.7.2