self.ap.clear()
        self.mcastropi.clear()

#run
if __name__ == "__main__":

    print("SpaceCRAFT - Minecraft Interactive Astro Pi")

    #create connection to minecraft
    mc = Minecraft.create()

    #create the astro pi object
    ap = AstroPi()
    #read data from the astro pi to initialise it
    ap.get_orientation()
    ap.get_humidity()
    ap.get_pressure()

    #find the players position and create the astro pi 10 blocks above them
    pos = mc.player.getTilePos()
    pos.y += 10
    mcap = MCInteractiveAstroPi(mc, ap, pos)

    try:
        print("CTRL C to quit")
        while(True):
            #each time a block is hit pass it to the interactive astro pi
            for blockHit in mc.events.pollBlockHits():
                mcap.interact(blockHit.pos)
            #keep reading the astro pi orientation data otherwise it goes out of sync
            ap.get_orientation()
Example #2
0
#!/usr/bin/env python
from sense_hat import AstroPi
import time
import datetime
import pygame
from pygame.locals import *

ap = AstroPi()
ap.clear()

pygame.init()
pygame.display.set_mode((640, 480))

pressure = 'P: ' + str(int(ap.get_pressure()))
temp = 'T: ' + str(int(ap.get_temperature_from_pressure()))
humidity = 'H: ' + str(int(ap.get_humidity()))
blah = 'blah!'


def handle_event(event):
    if event.key == pygame.K_DOWN:
        ap.show_message(pressure)
    elif event.key == pygame.K_UP:
        ap.show_message(temp)
    elif event.key == pygame.K_LEFT:
        ap.show_message(humidity)
    elif event.key == pygame.K_RIGHT:
        ap.show_message(blah)


running = True
Example #3
0
#!/usr/bin/env python
from sense_hat import AstroPi
import time
import datetime
from pygame.locals import *
import requests

ap = AstroPi()

humid = int(ap.get_humidity())

print humid
Example #4
0
        self.mcastropi.clear()


#run
if __name__ == "__main__":

    print("SpaceCRAFT - Minecraft Interactive Astro Pi")

    #create connection to minecraft
    mc = Minecraft.create()

    #create the astro pi object
    ap = AstroPi()
    #read data from the astro pi to initialise it
    ap.get_orientation()
    ap.get_humidity()
    ap.get_pressure()

    #find the players position and create the astro pi 10 blocks above them
    pos = mc.player.getTilePos()
    pos.y += 10
    mcap = MCInteractiveAstroPi(mc, ap, pos)

    try:
        print("CTRL C to quit")
        while (True):
            #each time a block is hit pass it to the interactive astro pi
            for blockHit in mc.events.pollBlockHits():
                mcap.interact(blockHit.pos)
            #keep reading the astro pi orientation data otherwise it goes out of sync
            ap.get_orientation()
Example #5
0
import time
import datetime
import pygame
from pygame.locals import *
import requests

ap = AstroPi()
ap.clear()

pygame.init()
pygame.display.set_mode((640,480))


pressure = 'P: ' + str(int(ap.get_pressure()))
temp =  'T: ' + str(int(ap.get_temperature_from_pressure()))
humidity = 'H: ' + str(int(ap.get_humidity()))
blah = 'blah!'

def handle_event(event):
    if event.key == pygame.K_DOWN:
        ap.show_message(pressure)
    elif event.key == pygame.K_UP:
        ap.show_message(temp)
    elif event.key == pygame.K_LEFT:
        ap.show_message(humidity)
    elif event.key == pygame.K_RIGHT:
        ap.show_message(blah)


if int(ap.get_humidity()) <= 40:
    requests.post("https://maker.ifttt.com/trigger/turn_on/with/key/-coYRidDBPCNfXhRlFpbR")