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:
- 0:8aaf23a881c1
diff -r 000000000000 -r 8aaf23a881c1 main.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Fri Mar 06 22:02:17 2015 +0000
@@ -0,0 +1,19 @@
+#include "mbed.h"
+//example using InterruptIn with the input from the PIR motion sensors
+InterruptIn alarm(p11);
+DigitalOut led(LED1);
+DigitalOut flash(LED4);
+
+void flip() {
+ led = !led;
+}
+
+int main() {
+ alarm.mode(PullUp);
+ wait(2);
+ alarm.fall(&flip); // attach the address of the flip function to the falling edge
+ while(1) { // wait around, interrupts will interrupt
+ flash = !flash;
+ wait(0.25);
+ }
+}
\ No newline at end of file