Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: main.cpp
- Revision:
- 2:603a8ac68090
- Parent:
- 1:d343cf676574
- Child:
- 3:50a3fc3bce95
--- a/main.cpp Wed May 17 09:17:45 2017 +0200 +++ b/main.cpp Mon May 29 15:10:02 2017 +0200 @@ -7,22 +7,25 @@ InterruptIn mybutton(USER_BUTTON); -double tempo = 0.2; //time to wait +double tempo = 0.2; // LED blinking delay -void changetempo() { - if(tempo == 0.2) // If leds have low frequency - tempo = 0.1; // Set the fast frequency - else // If les have fast frequency - tempo = 0.2; // Set the low frequency +// Change LEDs blinking frequency +void change_blinking_frequency() { + if (tempo == 0.3) // If leds have low frequency + tempo = 0.1; // Set the fast frequency + else // If leds have fast frequency + tempo = 0.3; // Set the low frequency } int main() { - myled1 = 0; //LED1 is OFF - myled2 = 0; //LED2 is OFF - myled3 = 0; //LED3 is OFF - myled4 = 0; //LED4 is OFF + // All LEDs are OFF + myled1 = 0; + myled2 = 0; + myled3 = 0; + myled4 = 0; - mybutton.fall(&changetempo); //Interrupt to change tempo + // Change LEDs blinking frequency when button is pressed + mybutton.fall(&change_blinking_frequency); while(1) { myled2 = 1; // LED2 is ON