![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
First mbed program example and usage
Fork of HelloWorld by
main.cpp
- Committer:
- efoster79
- Date:
- 2014-11-08
- Revision:
- 4:48af6a1a72c6
- Parent:
- 3:26b01dec4312
File content as of revision 4:48af6a1a72c6:
#include "mbed.h" #define TOTAL_LEDS 4 DigitalOut outleds[TOTAL_LEDS] = { LED1, LED2, LED3, LED4 }; int main() { int last_selected = 1; int i; while(1) { for(i = 0 ; i < TOTAL_LEDS; i++){ int value_to_check = i + 1; outleds[i] = value_to_check == last_selected ? 1 : 0; } wait(1); if(last_selected++ >= TOTAL_LEDS) last_selected = 1; } }