István Cserny / Mbed 2 deprecated Lab04_b2int

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
cspista
Date:
Tue Nov 16 12:27:01 2021 +0000
Commit message:
Final version

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r 0d020f921452 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue Nov 16 12:27:01 2021 +0000
@@ -0,0 +1,23 @@
+#include "mbed.h"
+
+InterruptIn b_on(PC_10);       // Pusbutton input (PC_10)
+InterruptIn b_off(PC_12);      // Pusbutton input (PC_12)
+DigitalOut led(LED1);          // LED output (PA_5)
+
+void b_on_pressed() {
+    led = 1;                   // LED on
+}
+
+void b_off_pressed() {
+    led = 0;                   // LED off
+}
+
+int main() {
+    b_on.mode(PullUp);         // Enable internal pullup
+    b_on.fall(&b_on_pressed);  // Attach function to falling edge
+    b_off.mode(PullUp);        // Enable internal pullup
+    b_off.fall(&b_off_pressed); // Attach function to falling edge
+    while (true) {
+        wait(0.2f);            // Nothing to do. Just wait
+    }
+}
\ No newline at end of file
diff -r 000000000000 -r 0d020f921452 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Tue Nov 16 12:27:01 2021 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400
\ No newline at end of file