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:
- 3:f6547e1c1dfc
- Parent:
- 1:76d11e984b8d
- Child:
- 4:90f9fff2e44e
--- a/main.cpp Thu Oct 21 13:33:43 2021 +0000 +++ b/main.cpp Thu Oct 21 13:43:27 2021 +0000 @@ -2,26 +2,31 @@ //Blinks LED2 every 200ms using a single Ticker object. //Created: S. Licht, 10/04/2020 #include "mbed.h" -Ticker tickerLED2; //creat ticker object +Ticker tickerLED2; //create ticker object +Ticker tickerLED3; DigitalOut LEDOut2(LED2); +DigitalOut LEDOut3(LED3); void changeLED2() //the function that will be called by the ticker object. { LEDOut2 = !LEDOut2; } +void changeLED3() //the function that will be called by the ticker object. +{ + LEDOut3 = !LEDOut3; +} + + int main() { tickerLED2.attach(&changeLED2,0.2); //the address of the function to call //and the interval in seconds between //calls to that function - while(1) { - wait(0.1); - wait(0.1); - wait(0.1); - wait(0.1); - wait(0.1); + tickerLED3.attach(&changeLED3,0.3); + + //the main loop is spinning every 500ms, but the LED needs to go faster! - } //while + //while }