# Can't find pins class

**URL:** <https://forum.makecode.com/t/cant-find-pins-class/18180>\
**Category:** micro:bit\
**Created:** [February 26, 2023, 8:57pm UTC](https://forum.makecode.com/t/cant-find-pins-class/18180 "2023-02-26T20:57:22Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![bethesda](https://avatars.discourse-cdn.com/v4/letter/b/4bbf92/32.png) [@bethesda](https://forum.makecode.com/u/bethesda)\
**Post date:** [February 26, 2023, 8:57pm UTC](https://forum.makecode.com/t/cant-find-pins-class/18180/1 "2023-02-26T20:57:23Z")

</div>

Trying to read an analog voltage on either pin 0, 1, or 2. Can do this in MakeCode but want to do it in Python instead. When I do it in MakeCode, and then I switch the editor to get the equivalent Python code, that code looks like this:

def on\_forever():  
basic.show\_number(pins.analog\_read\_pin(AnalogPin.P0))  
basic.forever(on\_forever)

When I paste that code into the Python editor, it can’t find ‘basic’ or ‘pins’. I’m assuming those are needed imports but I can’t figure out how to resolve that problem.

Thanks

---

<div class="post-metadata">

**Author:** ![bsiever](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/bsiever/32/1032_2.png) [@bsiever](https://forum.makecode.com/u/bsiever)\
**Post date:** [February 26, 2023, 9:20pm UTC](https://forum.makecode.com/t/cant-find-pins-class/18180/2 "2023-02-26T21:20:44Z")

</div>

Are you pasting it into the MakeCode Python editor or the Python-only editor, like this one: [https://python.microbit.org/v/3](https://python.microbit.org/v/3) ?

The Python-only editor uses a different version of Python than MakeCode. You can read about the differences between the two types of Python here: [https://support.microbit.org/support/solutions/articles/19000111744-makecode-python-and-micropython](https://support.microbit.org/support/solutions/articles/19000111744-makecode-python-and-micropython)

The different version, called MicroPython, has different names for the commands, which are described here: [https://microbit-micropython.readthedocs.io/en/v2-docs/](https://microbit-micropython.readthedocs.io/en/v2-docs/). In the Python-only (MicroPython) version it would look like this:

```auto
from microbit import *

while True:
    display.show(pin0.read_analog())

```

---

<div class="post-metadata">

**Author:** ![bethesda](https://avatars.discourse-cdn.com/v4/letter/b/4bbf92/32.png) [@bethesda](https://forum.makecode.com/u/bethesda)\
**Post date:** [February 27, 2023, 6:19pm UTC](https://forum.makecode.com/t/cant-find-pins-class/18180/3 "2023-02-27T18:19:14Z")

</div>

Thanks I’ll try!

It’s really not clear which Python context I’m in. How does one determine this from the navigation / GUI?

David

---

<div class="post-metadata">

**Author:** ![bsiever](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/bsiever/32/1032_2.png) [@bsiever](https://forum.makecode.com/u/bsiever)\
**Post date:** [February 28, 2023, 10:52pm UTC](https://forum.makecode.com/t/cant-find-pins-class/18180/4 "2023-02-28T22:52:08Z")

</div>

Hi @bethesda,

The _MakeCode_ Python code only works in _MakeCode_. If you are pasting the code into anyplace else, it’s probably expecting the MicroPython approach. That is, any place other than [makecode.microbit.org](http://makecode.microbit.org) is probably MicroPython and you need to use the approaches described here: [https://microbit-micropython.readthedocs.io/](https://microbit-micropython.readthedocs.io/) .

If you are using the MicroPython approach, the current micro:bit on-line Python editor works great! It’s at [https://python.microbit.org/v/3](https://python.microbit.org/v/3) . Here’s a very brief overview (thanks to Kitronic): [https://www.youtube.com/watch?v=6dLYpAume-A](https://www.youtube.com/watch?v=6dLYpAume-A)

Bill
