Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import time
- import RPi.GPIO as GPIO # import the GPIO module
- import minecraft
- import block
- import time
- mc = minecraft.Minecraft.create()
- GPIO.setmode(GPIO.BCM) # sets the mode to BCM (meaning that pin 17 refers to the 17th pin AKA GPIO 11
- GPIO.setup(17, GPIO.OUT) # marks pin 17 as an output pin
- GPIO.output(17, True) # sets pin 17 to true. Since pin 17 (GPIO 11) is marked as output, this will turn on your LED
- while True:
- time.sleep(0.1)
- playerPos = mc.player.getPos()
- y = int(playerPos.y)
- if y > 20:
- GPIO.output(17, True)
- else:
- GPIO.output(17, False)
Advertisement
Add Comment
Please, Sign In to add comment