From ecf956c537a801d6b0ccfaf4e14c840c2daf25c3 Mon Sep 17 00:00:00 2001 From: Alexander Kauerz Date: Wed, 15 Feb 2012 21:56:04 +0100 Subject: erste funktionierende version - bewegung wird erkannt. --- Drehimpulsgeber/drehimp.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'Drehimpulsgeber') diff --git a/Drehimpulsgeber/drehimp.cpp b/Drehimpulsgeber/drehimp.cpp index 21011e7..4f64629 100644 --- a/Drehimpulsgeber/drehimp.cpp +++ b/Drehimpulsgeber/drehimp.cpp @@ -1,8 +1,16 @@ +#include + +void doCount0(); +void doCount1(); + volatile int cnt0 = 0; // Digitaler Pin 2 und 3 volatile int cnt1 = 0; void setup() -{ attachInterrupt(0, doCount0, CHANGE); +{ + digitalWrite(2, HIGH); + digitalWrite(3, HIGH); + attachInterrupt(0, doCount0, CHANGE); attachInterrupt(1, doCount1, CHANGE); Serial.begin(9600); } @@ -15,5 +23,6 @@ void loop() } // Dummy interrupt functions -void doCount0() { cnt0++;  } -void doCount1() { cnt1++;  } +void doCount0() {cnt0++;} +void doCount1() {cnt1++;} + -- cgit v1.2.3