コード例 #1
0
from astro_pi import AstroPi
ap = AstroPi()

while True:
    t = ap.get_temperature()
    p = ap.get_pressure()
    h = ap.get_humidity()

    t = round(t,1)
    p = round(p,1)
    h = round(h,1)

    msg = "Temperature = %s, Pressure=%s, Humidity=%s" % (t,p,h)

    ap.show_message(msg,scroll_speed=0.05)
コード例 #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
コード例 #3
0
from astro_pi import AstroPi

ap = AstroPi()

pressure = ap.get_pressure()

print("Pressure", pressure)



コード例 #4
0
#read all astro pi sensors
#a test to see how quick it is

from time import time, sleep
from astro_pi import AstroPi

ap = AstroPi()
ap.get_humidity()
ap.get_pressure()
ap.get_orientation()

while (True):
    starttime = time()

    hum = ap.get_humidity()
    pres = ap.get_pressure()
    temp1 = ap.get_temperature_from_humidity()
    temp1 = ap.get_temperature_from_pressure()
    rads = ap.get_orientation_radians()
    degs = ap.get_orientation_degrees()
    rawcomp = ap.get_compass_raw()
    rawgyro = ap.get_gyroscope_raw()
    rawaccel = ap.get_accelerometer_raw()

    endtime = time()

    print(endtime - starttime)
    sleep(1)
コード例 #5
0
ファイル: readsensors.py プロジェクト: astro-pi/SpaceCRAFT
# read all astro pi sensors
# a test to see how quick it is

from time import time, sleep
from astro_pi import AstroPi

ap = AstroPi()
ap.get_humidity()
ap.get_pressure()
ap.get_orientation()

while True:
    starttime = time()

    hum = ap.get_humidity()
    pres = ap.get_pressure()
    temp1 = ap.get_temperature_from_humidity()
    temp1 = ap.get_temperature_from_pressure()
    rads = ap.get_orientation_radians()
    degs = ap.get_orientation_degrees()
    rawcomp = ap.get_compass_raw()
    rawgyro = ap.get_gyroscope_raw()
    rawaccel = ap.get_accelerometer_raw()

    endtime = time()

    print(endtime - starttime)
    sleep(1)
コード例 #6
0
ファイル: ISS_Tracker.py プロジェクト: TeCoEd/iss-tracker
#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   15185.95963984  .00006354  00000-0  98170-4 0  9990"
line2 = "2 25544  51.6454 355.2696 0003202 121.3230  14.1346 15.55509232950800"

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