A collection of examples organized from basics to advanced.

Dependencies:   mbed SDFileSystem

Mbed online compiler has no facility to easily manage a lot of programs or organized them in to related folders. This makes creating an examples and sample pack difficult.

This repository contains a single main.cpp file (which does very little), and a BuildOptions.h file. Simply uncomment the example you would like to compile from the build options. Each example is wrapped in a compiler directive.

If the directive does not include a description comment, it likely does not exist yet. If you would like to contribute to the Examples project, please contact me or fork and issue a pull request.

Revision:
1:9a043ee174de
Parent:
0:b471f7764d46
diff -r b471f7764d46 -r 9a043ee174de 02_Digital/Button_Interrupt.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/02_Digital/Button_Interrupt.cpp	Fri Jul 05 04:52:18 2019 +0000
@@ -0,0 +1,33 @@
+
+#ifdef  COMPILE_Button_Interrupt
+
+
+InterruptIn button(USER_BUTTON);
+
+DigitalOut led(LED1);
+
+double delay = 0.5; // 500 ms
+
+void pressed()
+{
+    delay = 0.1; // 100 ms
+}
+
+void released()
+{
+    delay = 0.5; // 500 ms
+}
+
+int main()
+{
+    // Assign functions to button
+    button.fall(&pressed);
+    button.rise(&released);
+
+    while (1) {
+        led = !led;
+        wait(delay);
+    }
+}
+
+#endif
\ No newline at end of file