Created
May 22, 2015 18:38
-
-
Save don/710774f17ee967eeb61c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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