Skip to content

Instantly share code, notes, and snippets.

@ShakataGaNai
Created January 29, 2018 17:07
Show Gist options
  • Save ShakataGaNai/23d2bef5fd17232ba9e178abb9e995df to your computer and use it in GitHub Desktop.
Save ShakataGaNai/23d2bef5fd17232ba9e178abb9e995df to your computer and use it in GitHub Desktop.
A hello world (blinking LED) for Micropython on the Wemos D1 Mini (ESP8266)
@ShakataGaNai
Copy link
Author

Correct, one in the same. In micropython its based on the GPIO number, rather than A/D labels, very confusing, I know. Look at https://randomnerdtutorials.com/esp8266-pinout-reference-gpios/ who's got a good list of the different pinout's.

@ofen
Copy link

ofen commented Nov 6, 2021

On my WeMos NodeMCU ESP8266 led pin is inverted. Use machine.Signal for this case https://github.com/micropython/micropython/blob/master/examples/hwapi/hwconfig_esp8266_esp12.py#L5.

@rohanraj-aipro
Copy link

from machine import Pin
from machine import ADC
from time import sleep_ms

x = ADC(Pin(2, Pin.IN))
y = ADC(Pin(5, Pin.IN))
x.atten(ADC.ATTN_11DB)
y.atten(ADC.ATTN_11DB)

while True:
    x_val = x.read()
    y_val = y.read()
    print('Current position:{},{}'.format(x_val,y_val))
    sleep_ms(300)

Traceback (most recent call last):
  File "<stdin>", line 5, in <module>
TypeError: can't convert Pin to int

@rohanraj-aipro
Copy link

what is the issue here ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment