summaryrefslogtreecommitdiffstats
path: root/Drehimpulsgeber/drehimp.cpp
blob: 21011e73725694b4bcd33ac2ceffda3fc0ea5ce4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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++;  }