Skip to content

Commit

Permalink
Moved opponent sensor software pull-up into the oppSensorValue
Browse files Browse the repository at this point in the history
  • Loading branch information
noqman committed Nov 18, 2024
1 parent c89e5ff commit 15182c0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
8 changes: 0 additions & 8 deletions main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,6 @@ const REG_VIN_R2 = 34;
const REG_ADD_DIP = 35;
const REG_ADD_RESET = 36;

// Software pullup for the opponent sensors
pins.setPull(DigitalPin.P16, PinPullMode.PullUp)
pins.setPull(DigitalPin.P15, PinPullMode.PullUp)
pins.setPull(DigitalPin.P14, PinPullMode.PullUp)
pins.setPull(DigitalPin.P13, PinPullMode.PullUp)
pins.setPull(DigitalPin.P12, PinPullMode.PullUp)


/**
* Blocks for SUMO:BIT.
*/
Expand Down
7 changes: 7 additions & 0 deletions opponent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,13 @@ namespace sumobit {
//% position.fieldEditor="gridpicker" position.fieldOptions.columns=5
export function oppSensorValue(sensor: SumobitSensorSelection1): number {

// Software pullup for the opponent sensors
pins.setPull(DigitalPin.P16, PinPullMode.PullUp)
pins.setPull(DigitalPin.P15, PinPullMode.PullUp)
pins.setPull(DigitalPin.P14, PinPullMode.PullUp)
pins.setPull(DigitalPin.P13, PinPullMode.PullUp)
pins.setPull(DigitalPin.P12, PinPullMode.PullUp)

switch (sensor) {
case SumobitSensorSelection1.Left:
return pins.digitalReadPin(DigitalPin.P16);
Expand Down

0 comments on commit 15182c0

Please sign in to comment.