Digital read pin does not work

I am trying to create a simple program to read pin0, but it does not work. Any suggestions?
The pseudocode is like this:

forever
    if digital pin0 = 1
    show some leds

Hi @kmll , Welcome to the forum.

Is the code in Python or MakeCode? Did you do anything special to set up the pin (pull up or pull down) and how are you testing it?

Welcome, @kmll, and sorry to intrude here, @bsiever!

But I am trawling the forum to find questions to drill and challenge my own skills using MakeCode, and I found this one interesting and relevant.

With reference to @bsiever’s follow-up questions, I am not sure if this answer your question, but here is a code example which I believe does what you ask, shows some LEDs if pin0 is set to digital 1 by physically either connecting pin1 to pin0 or from an outside source to pin0. In simulator, just press pin0 to activate/set to 1.

Thank you for the advise. I also posted the question in another forum and please have a look at the reply here if you want more details about the issue: https://support.microbit.org/support/tickets/67502

1 Like