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()
            #sleep for a bit
Exemple #2
0

#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()
            #sleep for a bit
Exemple #3
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
Exemple #4
0
#line1 = "1 25544U 98067A   15178.42973832  .00011523  00000-0  17276-3 0  9998"
#line2 = "2 25544  51.6456  32.8760 0003760  98.7829 323.8559 15.55421066949635"

line1 = "1 25544U 98067A   17236.92892593  .00001941  00000-0  36498-4 0  9995"
line2 = "2 25544  51.6393  55.6371 0005064 174.4795 337.0202 15.54195457 72448"

def countdown():
    for i in reversed(range(0, 6)):
        ap.show_letter(str(i))
        time.sleep(1)

countdown()        
ap.clear()
while True:
    temp = str(ap.get_temperature())
    pressure =  str(ap.get_pressure())
    orientation =  ap.get_orientation_degrees()

    time.sleep(0.5)
    tle_rec = ephem.readtle(name, line1, line2)
    tle_rec.compute()
    
    #convert to strings#
    lat2string = str(tle_rec.sublat)
    long2string = str(tle_rec.sublong)

    lati = lat2string.split(":")
    longt = long2string.split(":")

    ###Convert to floats to check the rangess