diff --git a/examples/dfRobotAnalogInSwitches/dfRobotAnalogInSwitches.ino b/examples/dfRobotAnalogInSwitches/dfRobotAnalogInSwitches.ino index 7d80f22..2fb606f 100644 --- a/examples/dfRobotAnalogInSwitches/dfRobotAnalogInSwitches.ino +++ b/examples/dfRobotAnalogInSwitches/dfRobotAnalogInSwitches.ino @@ -20,13 +20,10 @@ #include #include -// As per the above wiki this uses the default settings for analog ranges. +// The actual code that deals with the shield, this is the input abstraction that reads the button state from the +// analog input. The ranges are configurable and there are two defaults, both listed below. DfRobotInputAbstraction dfRobotKeys(dfRobotAvrRanges); // or dfRobotV1AvrRanges -// for V1.0 of the shield uncomment the below definition and comment out the above defintion -// this has the other settings for analog ranges. -//IoAbstractionRef dfRobotKeys = inputFromDfRobotShieldV1(); - void logKeyPressed(const char* whichKey, bool heldDown) { Serial.print("Key "); Serial.print(whichKey); diff --git a/examples/dfRobotRotaryEncoder/dfRobotRotaryEncoder.ino b/examples/dfRobotRotaryEncoder/dfRobotRotaryEncoder.ino index 9fcae34..25c2b28 100644 --- a/examples/dfRobotRotaryEncoder/dfRobotRotaryEncoder.ino +++ b/examples/dfRobotRotaryEncoder/dfRobotRotaryEncoder.ino @@ -51,6 +51,7 @@ public: // zero pad a numeric value to four letters and print it. char sz[10]; ltoaClrBuff(sz, encoderReading, 4, '0', sizeof sz); + lcd.setCursor(0, 1); lcd.print(sz); // now we print the select button state into right corner. diff --git a/examples/directionOnlyEncoder/directionOnlyEncoder.ino b/examples/directionOnlyEncoder/directionOnlyEncoder.ino index cf37af0..69d25c6 100644 --- a/examples/directionOnlyEncoder/directionOnlyEncoder.ino +++ b/examples/directionOnlyEncoder/directionOnlyEncoder.ino @@ -19,12 +19,12 @@ #include // The pin onto which we connected the rotary encoders switch -const int spinwheelClickPin = 4; +const int spinwheelClickPin = 7; // The two pins where we connected the A and B pins of the encoder. I recomend you dont change these // as the pin must support interrupts. -const int encoderAPin = 5; -const int encoderBPin = 6; +const int encoderAPin = 3; +const int encoderBPin = 4; // // When the spinwheel is clicked, this function will be run as we registered it as a callback @@ -55,7 +55,7 @@ void setup() { // First we set up the switches library, giving it the task manager and tell it to use arduino pins // We could also of chosen IO through an i2c device that supports interrupts. // If you want to use PULL DOWN instead of PULL UP logic, change the true to false below. - switches.initialise(internalDigitalIo(), true); + switches.initialise(asIoRef(internalDigitalDevice()), true); // now we add the switches, we dont want the spinwheel button to repeat, so leave off the last parameter // which is the repeat interval (millis / 20 basically) Repeat button does repeat as we can see. @@ -66,7 +66,7 @@ void setup() { // when we do this, the callback either gets 0 no change, -1 down or 1 up. // The easiest way to configure direction mode is by setting the user intention as below. setupRotaryEncoderWithInterrupt(encoderAPin, encoderBPin, onEncoderChange); - switches.getEncoder(0)->setUserIntention(DIRECTION_ONLY); + switches.getEncoder()->setUserIntention(DIRECTION_ONLY); } void loop() {