Add CesarSound code.
This commit is contained in:
25
lib/Rotary/examples/Polling/Polling.ino
Normal file
25
lib/Rotary/examples/Polling/Polling.ino
Normal file
@ -0,0 +1,25 @@
|
||||
/*
|
||||
Rotary Encoder - Polling Example
|
||||
|
||||
The circuit:
|
||||
* encoder pin A to Arduino pin 2
|
||||
* encoder pin B to Arduino pin 3
|
||||
* encoder ground pin to ground (GND)
|
||||
|
||||
*/
|
||||
|
||||
#include <Rotary.h>
|
||||
|
||||
Rotary r = Rotary(2, 3);
|
||||
|
||||
void setup() {
|
||||
Serial.begin(9600);
|
||||
r.begin(true);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
unsigned char result = r.process();
|
||||
if (result) {
|
||||
Serial.println(result == DIR_CW ? "Right" : "Left");
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user