Skip to content

Instantly share code, notes, and snippets.

@don
Created May 22, 2015 18:38
Show Gist options
  • Save don/710774f17ee967eeb61c to your computer and use it in GitHub Desktop.
Save don/710774f17ee967eeb61c to your computer and use it in GitHub Desktop.
#include <Encoder.h>
Encoder encoder(3,4);
// Import libraries (BLEPeripheral depends on SPI)
#include <SPI.h>
#include <BLEPeripheral.h>
#define BLE_REQ 9
#define BLE_RDY 8
#define BLE_RST 5
//Encoder encoder(3,4);
BLEPeripheral blePeripheral = BLEPeripheral(BLE_REQ, BLE_RDY, BLE_RST);
//Encoder encoder(3,4);
long oldPosition = -999;
void setup() {
Serial.begin(9600);
Serial.println(F("BLE LED Dimmable Peripheral"));
}
void loop() {
long newPosition = encoder.read();
if (newPosition != oldPosition) {
oldPosition = newPosition;
Serial.println(newPosition);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment