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)
@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