2 Tasten steuern 2 Interrupts welche 2 4bit Counter bedienen

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
heseg
Date:
Fri Nov 22 15:03:43 2019 +0000
Parent:
0:7a20a6aa1f5e
Commit message:
2 Tasten, 2 Interrupts, 2 Counter (4bit)

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
--- a/main.cpp	Fri Feb 15 15:13:19 2013 +0000
+++ b/main.cpp	Fri Nov 22 15:03:43 2019 +0000
@@ -1,17 +1,36 @@
+/* ********************************************************** */
+/* *************** Projekt: BuNuc_Interrupt_Taste *********** */
+/* BULME Graz, Abteilung Elektronik und Technische Informatik */
+/* ********************************************************** */
+// 2 Tasten bedienen je einen 4 bit Zähler, Visualisierung durch LED
 #include "mbed.h"
  
-InterruptIn button(p5);
-DigitalOut led(LED1);
-DigitalOut flash(LED4);
+InterruptIn taste1 (A1);
+InterruptIn taste2 (A2);
+BusOut vtaste1(D11, D12, A6, D13);
+BusOut vtaste2(D2, D3, D6, D9);
+DigitalOut rgb(D0);
+
+short counter1, counter2;
  
-void flip() {
-    led = !led;
+void flip1()  // Interruptprogramm 1
+{
+    vtaste1 = ++counter1;
+    if(vtaste1==16) counter1=0;
 }
+void flip2()  // Interruptprogramm 2
+    {
+    vtaste2 = ++counter2;
+    if(vtaste2==16) counter2=0;  
+    }
  
-int main() {
-    button.rise(&flip);  // attach the address of the flip function to the rising edge
-    while(1) {           // wait around, interrupts will interrupt this!
-        flash = !flash;
+int main()
+{
+    taste1.fall(&flip1);  // attach the address of the flip function to the falling edge
+    taste2.fall(&flip2);  // attach the address of the flip function to the falling edge
+    while(1) 
+    {           // wait around, interrupts will interrupt this!
+        rgb = !rgb;
         wait(0.25);
     }
 }
\ No newline at end of file
--- a/mbed.bld	Fri Feb 15 15:13:19 2013 +0000
+++ b/mbed.bld	Fri Nov 22 15:03:43 2019 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/mbed/builds/0954ebd79f59
\ No newline at end of file
+https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400
\ No newline at end of file