Last active
December 30, 2015 22:34
-
-
Save KramKroc/417564f8105e4460c60d to your computer and use it in GitHub Desktop.
How to control an led from minecraft
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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