kind of work but still buggy

This commit is contained in:
hathach committed 2017-09-13 16:10:04 +07:00
1 parent 4cad241156
commit 972c4067d6
1 file changed
+32
@@ -15,4 +15,36 @@
#include <Arduino.h>
#include "HardwareEncoder.h"
HardwareEncoder encoder(A0, A1);
void setup()
{
Serial.begin(115200);
Serial.println("Bluefruit52 Hardware Encoder OneKnob Example");
Serial.println("--------------------------------------------\n");
// Initialize Encoder
encoder.begin();
// Enable hardware debouncing
encoder.setDebounce(true);
// Start encoder
encoder.start();
}
void loop()
{
int value = encoder.read();
if (value)
{
if ( value > 0 )
{
Serial.println("Right");
}else
{
Serial.println("Left");
}
}
}