Skip to content

Instantly share code, notes, and snippets.

@KramKroc
Last active December 30, 2015 22:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KramKroc/417564f8105e4460c60d to your computer and use it in GitHub Desktop.
Save KramKroc/417564f8105e4460c60d to your computer and use it in GitHub Desktop.
How to control an led from minecraft
from mcpi.minecraft import Minecraft
from gpiozero import LED
mc = Minecraft.create()
led = LED(4)
# blocks
redstone_ore = 73
while True:
x, y, z = mc.player.getTilePos()
block = mc.getBlock(x, y-1, z)
if block == redstone_ore:
led.on()
else:
led.off()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment