This is a simple program that flashes lights on the MBED LPC1768

Dependencies:   mbed

Committer:
rmcwilliam101
Date:
Mon Jun 29 12:23:22 2015 +0000
Revision:
0:e032b329184f
Lights rev 1.0

Who changed what in which revision?

UserRevisionLine numberNew contents of line
rmcwilliam101 0:e032b329184f 1 #include "mbed.h"
rmcwilliam101 0:e032b329184f 2 /* This program flashes lights on the MBED */
rmcwilliam101 0:e032b329184f 3
rmcwilliam101 0:e032b329184f 4 /* Define some useful constants */
rmcwilliam101 0:e032b329184f 5 #define ON 1
rmcwilliam101 0:e032b329184f 6 #define OFF 0
rmcwilliam101 0:e032b329184f 7
rmcwilliam101 0:e032b329184f 8 /* Create names for lights */
rmcwilliam101 0:e032b329184f 9 DigitalOut light1(LED1); /* Control LED1 using light1 */
rmcwilliam101 0:e032b329184f 10 DigitalOut light2(LED2); /* Control LED2 using light2 */
rmcwilliam101 0:e032b329184f 11
rmcwilliam101 0:e032b329184f 12 // Main loop
rmcwilliam101 0:e032b329184f 13 int main()
rmcwilliam101 0:e032b329184f 14 {
rmcwilliam101 0:e032b329184f 15 /* Define a while loop that runs forever (or until the MBED is reset) */
rmcwilliam101 0:e032b329184f 16 while(1)
rmcwilliam101 0:e032b329184f 17 {
rmcwilliam101 0:e032b329184f 18 light1=ON; /* Switch light 1 on */
rmcwilliam101 0:e032b329184f 19 light2=OFF; /* Switch light2 off */
rmcwilliam101 0:e032b329184f 20 wait(0.1); /* Pause for 0.1 seconds (= 100 milliseconds) */
rmcwilliam101 0:e032b329184f 21 light1=OFF;
rmcwilliam101 0:e032b329184f 22 light2=ON;
rmcwilliam101 0:e032b329184f 23 wait(0.1);
rmcwilliam101 0:e032b329184f 24 }
rmcwilliam101 0:e032b329184f 25 }