Lights the barrery LED one-by-one, in an interval of 0.5 seconds. When button A is pressed, the LEDS hold.
main.cpp
00001 #include "mbed.h" 00002 #include "TFC.h" 00003 00004 int main() 00005 { 00006 TFC_Init(); //Initiate the TFC 00007 int i=0; //Set counter to 0 00008 for(;;) { // Loop start 00009 if(TFC_PUSH_BUTTON_0_PRESSED) //If button 0 is pressed 00010 while(TFC_PUSH_BUTTON_0_PRESSED) { 00011 TFC_SetBatteryLED_Level(i); 00012 //Hold the battery leds on value i for 00013 //as long as the button is pressed 00014 } 00015 00016 else //If button 0 is NOT pressed 00017 TFC_SetBatteryLED_Level(i); 00018 wait(0.5); 00019 if(i>4) 00020 i = 0; 00021 //Keep setting the to value i and increment i, 00022 //if i goes above 4, reset the LEDS 00023 i++; 00024 } //Loop end 00025 } //Main end 00026
Generated on Tue Jul 12 2022 21:29:26 by 1.7.2