Skip to content

Commit

Permalink
examples prepared for release
Browse files Browse the repository at this point in the history
  • Loading branch information
davetcc committed Dec 28, 2022
1 parent c3fbece commit 482ee1f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
7 changes: 2 additions & 5 deletions examples/dfRobotAnalogInSwitches/dfRobotAnalogInSwitches.ino
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,10 @@
#include <DfRobotInputAbstraction.h>
#include <TaskManagerIO.h>

// 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);
Expand Down
1 change: 1 addition & 0 deletions examples/dfRobotRotaryEncoder/dfRobotRotaryEncoder.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
10 changes: 5 additions & 5 deletions examples/directionOnlyEncoder/directionOnlyEncoder.ino
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@
#include <TaskManagerIO.h>

// 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
Expand Down Expand Up @@ -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.
Expand All @@ -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() {
Expand Down

0 comments on commit 482ee1f

Please sign in to comment.