Skip to content

set_pull(NO_PULL) behaves differently between V1 and V2 #158

@martinwork

Description

@martinwork

Arising from https://support.microbit.org/helpdesk/tickets/64103 (private)

I used the program below in a micro:bit with P0 connected to P1.
P1 sends it's analogue value to uart.
Press A to set P0 to NO_PULL.

In V1, P1's value drops as soon as A is pressed.
In V2, P1's value remains steady until B is pressed to make P0 a digital input.

In MakeCode and C++, V1 behaves like V2
https://makecode.microbit.org/_g2c94FA4k6bE
nopull.zip

The program in the ticket was relying on the V1 behaviour, so stopped working with V2.

from microbit import *

pin0.write_digital(1)

while True:
    if button_a.was_pressed():
        pin0.set_pull(pin0.NO_PULL)
    if button_b.was_pressed():
        pin0.read_digital()
        
    uart.write("p1:"+str(pin1.read_analog())+"\r\n")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions