summaryrefslogtreecommitdiffstats
path: root/Drehimpulsgeber/drehimp.cpp
blob: 4f646293895ce8d47c66162d611f84c2254403dc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <Arduino.h>

void doCount0();
void doCount1();

volatile int cnt0 = 0; // Digitaler Pin 2 und 3
volatile int cnt1 = 0;

void setup()
{ 
  digitalWrite(2, HIGH);
  digitalWrite(3, HIGH);
  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++;}