Skip to content

Instantly share code, notes, and snippets.

@xeecos
Created Jun 15, 2021
Embed
What would you like to do?
read sensor
###USAGE###
# pip3 install makeblock --upgrade
###########
from time import sleep
from makeblock import MegaPi,SerialPort
megapi = MegaPi.connect() # or megapi = MegaPi.connect(SerialPort.connect("/dev/ttyXXXX"))
A6 = 60
A7 = 61
A8 = 62
A9 = 63
A10= 64
A11= 65
A12= 66
A13= 67
A14= 68
A15= 69
pin = megapi.Pin()
while(1):
print(pin.digital_read(A6),pin.digital_read(A7),pin.digital_read(A8))
sleep(0.1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment