Electornic dice application for mBuino platform

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 //#include "rtos.h"
00003 
00004 float delayTime = .05;
00005 
00006 DigitalOut LED[] = {(P0_7), (P0_8), (P0_2), (P0_20), (P1_19), (P0_17), (P0_23)};// declare 7 LEDs
00007 
00008 int main()
00009 {
00010     int i = 0;
00011     while( i < 10 ) {
00012         for(int x = 0; x < 7; x++) {
00013             LED[x] = 1; // turn on
00014             wait(delayTime); // delay
00015         }
00016         for(int x = 0; x < 7; x++) {
00017             LED[x] = 0; // turn off
00018             wait(delayTime); // delay
00019         }
00020         for(int x = 6; x >= 0; x--) {
00021             LED[x] = 1; // turn on
00022             wait(delayTime); // delay
00023         }
00024         for(int x = 6; x >= 0; x--) {
00025             LED[x] = 0; // turn off
00026             wait(delayTime); // delay
00027         }
00028 
00029         i++;
00030     }
00031 
00032     //Thread::wait(osWaitForever);
00033 }