Edwin Foster
/
HelloWorld
First mbed program example and usage
Fork of HelloWorld by
Embed:
(wiki syntax)
Show/hide line numbers
main.cpp
00001 #include "mbed.h" 00002 00003 #define TOTAL_LEDS 4 00004 00005 DigitalOut outleds[TOTAL_LEDS] = { LED1, LED2, LED3, LED4 }; 00006 00007 int main() { 00008 00009 int last_selected = 1; 00010 int i; 00011 00012 while(1) { 00013 for(i = 0 ; i < TOTAL_LEDS; i++){ 00014 int value_to_check = i + 1; 00015 outleds[i] = value_to_check == last_selected ? 1 : 0; 00016 } 00017 00018 wait(1); 00019 00020 if(last_selected++ >= TOTAL_LEDS) 00021 last_selected = 1; 00022 } 00023 }
Generated on Mon Aug 21 2023 04:43:50 by 1.7.2