Skip to content

Commit 482ee1f

Browse files
committed
examples prepared for release
1 parent c3fbece commit 482ee1f

File tree

3 files changed

+8
-10
lines changed

3 files changed

+8
-10
lines changed

examples/dfRobotAnalogInSwitches/dfRobotAnalogInSwitches.ino

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,10 @@
2020
#include <DfRobotInputAbstraction.h>
2121
#include <TaskManagerIO.h>
2222

23-
// As per the above wiki this uses the default settings for analog ranges.
23+
// The actual code that deals with the shield, this is the input abstraction that reads the button state from the
24+
// analog input. The ranges are configurable and there are two defaults, both listed below.
2425
DfRobotInputAbstraction dfRobotKeys(dfRobotAvrRanges); // or dfRobotV1AvrRanges
2526

26-
// for V1.0 of the shield uncomment the below definition and comment out the above defintion
27-
// this has the other settings for analog ranges.
28-
//IoAbstractionRef dfRobotKeys = inputFromDfRobotShieldV1();
29-
3027
void logKeyPressed(const char* whichKey, bool heldDown) {
3128
Serial.print("Key ");
3229
Serial.print(whichKey);

examples/dfRobotRotaryEncoder/dfRobotRotaryEncoder.ino

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ public:
5151
// zero pad a numeric value to four letters and print it.
5252
char sz[10];
5353
ltoaClrBuff(sz, encoderReading, 4, '0', sizeof sz);
54+
lcd.setCursor(0, 1);
5455
lcd.print(sz);
5556

5657
// now we print the select button state into right corner.

examples/directionOnlyEncoder/directionOnlyEncoder.ino

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@
1919
#include <TaskManagerIO.h>
2020

2121
// The pin onto which we connected the rotary encoders switch
22-
const int spinwheelClickPin = 4;
22+
const int spinwheelClickPin = 7;
2323

2424
// The two pins where we connected the A and B pins of the encoder. I recomend you dont change these
2525
// as the pin must support interrupts.
26-
const int encoderAPin = 5;
27-
const int encoderBPin = 6;
26+
const int encoderAPin = 3;
27+
const int encoderBPin = 4;
2828

2929
//
3030
// When the spinwheel is clicked, this function will be run as we registered it as a callback
@@ -55,7 +55,7 @@ void setup() {
5555
// First we set up the switches library, giving it the task manager and tell it to use arduino pins
5656
// We could also of chosen IO through an i2c device that supports interrupts.
5757
// If you want to use PULL DOWN instead of PULL UP logic, change the true to false below.
58-
switches.initialise(internalDigitalIo(), true);
58+
switches.initialise(asIoRef(internalDigitalDevice()), true);
5959

6060
// now we add the switches, we dont want the spinwheel button to repeat, so leave off the last parameter
6161
// which is the repeat interval (millis / 20 basically) Repeat button does repeat as we can see.
@@ -66,7 +66,7 @@ void setup() {
6666
// when we do this, the callback either gets 0 no change, -1 down or 1 up.
6767
// The easiest way to configure direction mode is by setting the user intention as below.
6868
setupRotaryEncoderWithInterrupt(encoderAPin, encoderBPin, onEncoderChange);
69-
switches.getEncoder(0)->setUserIntention(DIRECTION_ONLY);
69+
switches.getEncoder()->setUserIntention(DIRECTION_ONLY);
7070
}
7171

7272
void loop() {

0 commit comments

Comments
 (0)