From 4fd4cdfc86c0c1326fb73fd7302227dd299bab45 Mon Sep 17 00:00:00 2001 From: Alexander Kauerz Date: Wed, 15 Feb 2012 20:52:30 +0100 Subject: drehimpulsgeber test, nicht mal alpha.. --- Drehimpulsgeber/drehimp.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 Drehimpulsgeber/drehimp.cpp (limited to 'Drehimpulsgeber/drehimp.cpp') diff --git a/Drehimpulsgeber/drehimp.cpp b/Drehimpulsgeber/drehimp.cpp new file mode 100644 index 0000000..21011e7 --- /dev/null +++ b/Drehimpulsgeber/drehimp.cpp @@ -0,0 +1,19 @@ +volatile int cnt0 = 0; // Digitaler Pin 2 und 3 +volatile int cnt1 = 0; + +void setup() +{ attachInterrupt(0, doCount0, CHANGE); + attachInterrupt(1, doCount1, CHANGE); + Serial.begin(9600); +} + +void loop() +{ Serial.print(cnt0); + Serial.print(" - "); + Serial.println(cnt1); + delay(1000); +} + +// Dummy interrupt functions +void doCount0() { cnt0++;  } +void doCount1() { cnt1++;  } -- cgit v1.2.3