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.
Dependencies: mbed wave_player mbed-rtos 4DGL-uLCD-SE SDFileSystem X_NUCLEO_53L0A1 HC_SR04_Ultrasonic_Library
Diff: part3.h
- Revision:
- 2:4845e2dae429
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/part3.h Wed Feb 19 18:48:09 2020 +0000
@@ -0,0 +1,42 @@
+#include "mbed.h"
+
+DigitalOut led1(LED1);
+DigitalOut led2(LED2);
+DigitalOut led3(LED3);
+DigitalOut led4(LED4);
+
+Ticker ticker1;
+Ticker ticker2;
+Ticker ticker3;
+Ticker ticker4;
+
+void flipLED1() {
+ led1 = !led1;
+}
+
+void flipLED2() {
+ led2 = !led2;
+}
+
+void flipLED3() {
+ led3 = !led3;
+}
+
+void flipLED4() {
+ led4 = !led4;
+}
+
+void run_part3() {
+ led1 = 0;
+ led2 = 0;
+ led3 = 0;
+ led4 = 0;
+
+ ticker1.attach(&flipLED1, 1.0);
+ ticker2.attach(&flipLED2, 2.0);
+ ticker3.attach(&flipLED3, 4.0);
+ ticker4.attach(&flipLED4, 8.0);
+
+ while(1);
+}
+
\ No newline at end of file