Lights the barrery LED one-by-one, in an interval of 0.5 seconds. When button A is pressed, the LEDS hold.
main.cpp
- Committer:
- NoamVH
- Date:
- 2016-05-14
- Revision:
- 4:7bb8fce3cdd6
- Parent:
- 3:d57fdbf06ac8
File content as of revision 4:7bb8fce3cdd6:
#include "mbed.h" #include "TFC.h" int main() { TFC_Init(); //Initiate the TFC int i=0; //Set counter to 0 for(;;) { // Loop start if(TFC_PUSH_BUTTON_0_PRESSED) //If button 0 is pressed while(TFC_PUSH_BUTTON_0_PRESSED) { TFC_SetBatteryLED_Level(i); //Hold the battery leds on value i for //as long as the button is pressed } else //If button 0 is NOT pressed TFC_SetBatteryLED_Level(i); wait(0.5); if(i>4) i = 0; //Keep setting the to value i and increment i, //if i goes above 4, reset the LEDS i++; } //Loop end } //Main end