Lights the barrery LED one-by-one, in an interval of 0.5 seconds. When button A is pressed, the LEDS hold.

Dependencies:   FRDM-TFC mbed

main.cpp

Committer:
NoamVH
Date:
2016-02-27
Revision:
3:d57fdbf06ac8
Parent:
2:61a8e97a0875
Child:
4:7bb8fce3cdd6

File content as of revision 3:d57fdbf06ac8:

#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 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