adafruit/pxt-crickit

pullups for signals

Opened this issue · 3 comments

The workaround (https://forums.adafruit.com/viewtopic.php?f=58&t=141212#p698302) of using other GPIO pins isn't easy to do when it's a micro:bit that's in the crickit unfortunately.

I'm using micro:bit, crickit and makecode with children. Having to add external pullups complicates the wiring significantly for a 7 year old, so I'd love to find how to enable the internal pullups.

I assume it'll mean sending some I2C commands to seesaw ( https://learn.adafruit.com/adafruit-seesaw-atsamd09-breakout/gpio ), so I'll start researching that; but I wanted to give a use-case for #11 and show there's interest.

A quick hack fix might be

diff --git a/signals.ts b/signals.ts
index 584c297..43ded6b 100644
--- a/signals.ts
+++ b/signals.ts
@@ -37,7 +37,7 @@ namespace crickit {
         //% pin.fieldOptions.columns=2
         digitalRead(): boolean {
             const dev = saw();
-            dev.pinMode(this._pin, 0);
+            dev.pinMode(this._pin, 0x02); // seesaw.ts INPUT_PULLUP = 0x02
             return dev.digitalRead(this._pin);
         }
 

I'll try out adding a new block/function to set the pullup separately to doing the read at the same time

@nicholas-gh it'd be a welcome PR!