Example #1
0
        O = [255, 255, 255]  # White

        UK = [
        O, O, O, X, X, O, O, O,
        O, O, O, X, X, O, O, O,
        O, O, O, X, X, O, O, O,
        X, X, X, X, X, X, X, X,
        X, X, X, X, X, X, X, X,
        O, O, O, X, X, O, O, O,
        O, O, O, X, X, O, O, O,
        O, O, O, X, X, O, O, O
        ]

        ap.set_pixels(UK)
        time.sleep(6)
        ap.show_message("Hello ISS, you are over the UK")
        ap.show_message("Hello ISS. How are you!", text_colour=[255, 0, 0])
        

    ###FRANCE###
    elif (lati[0] <= 49 and lati[0] >= 43) and (longt[0] >= -3 and longt[0] <= 6):    
        print "FRANCE"

        X = [255, 0, 0]  # Red 
        O = [255, 255, 255]  # White 
        b= [0,0, 255] #Blue
        French_Flag  = [ 
        b, b, b, O, O, O, X, X,
        b, b, b, O, O, O, X, X, 
        b, b, b, O, O, O, X, X, 
        b, b ,b, O, O, O, X, X, 
#!/usr/bin/python
import pygame

from pygame.locals import *
from sense_hat import AstroPi

pygame.init()
pygame.display.set_mode((640,480))
ap = AstroPi()

import sys

ap.show_message ("Game 1",text_colour=[255,0,50])
from random import *

y = [randint(1, 6), randint(1, 6), randint(1, 6)]
print(y)

import time

ap.show_letter (str(y[0]),text_colour=[255,0,0])
time.sleep(1)
ap.clear()
ap.show_letter (str(y[1]),text_colour=[255,0,0])
time.sleep(1)
ap.clear()
ap.show_letter (str(y[2]),text_colour=[255,0,0])
time.sleep(1)

ap.clear()
time.sleep(3)
Example #3
0
    time.sleep(10)
    blue = (0, 0, 255)
    ap.clear(blue)


# Waits for user input (middle button on joystick) before starting and makes LED green
green = (0, 255, 0)
ap.clear(green)
# Prevens EOF error
try:
    input()
except EOFError:
    print('eof error')
ap.clear()

# 5 second countdown
ap.show_message('5')
time.sleep(1)
ap.show_message('4')
time.sleep(1)
ap.show_message('3')
time.sleep(1)
ap.show_message('2')
time.sleep(1)
ap.show_message('1')
time.sleep(1)

# Runs the experiment
mainLoop(lengthMins, sleepSecs, camera, ap)
print('done')
#message arrays
goodbyes = ['Bye bye!', 'Have a great day!', 'See you soon!', 'Goodbye Tim!'] #the list of goodbye messages that can be chosen
greetings = ['Hi Tim!', 'How are you, Tim?', 'Howdy Tim!', 'Hello Tim!', 'Hey there Tim!'] #the list of greetings that can be chosen


#choose random message
def pickMessage(messages):
    num_messages = len(messages)
    num_picked = randint(0, num_messages - 1)
    message_picked = messages[num_picked]
    return message_picked   


#Greet Tim
ap.show_message(pickMessage(greetings)) #display a random greeting


#set up date/time
now = datetime.datetime.now() #the current date
thisday = now.strftime("%m-%d") #the current month and day


#take stats from station
StationTemp = 24 #We would get from sensor but Pi board gets hot so not accurate


#sort day and temperature into array
day = []
avTemp = []
    ap.clear(blue)



# Waits for user input (middle button on joystick) before starting and makes LED green
green = (0,255,0)
ap.clear(green)
# Prevens EOF error
try:
    input()
except EOFError:
    print('eof error')
ap.clear()

# 5 second countdown
ap.show_message('5')
time.sleep(1)
ap.show_message('4')
time.sleep(1)
ap.show_message('3')
time.sleep(1)
ap.show_message('2')
time.sleep(1)
ap.show_message('1')
time.sleep(1)
        

# Runs the experiment
mainLoop(lengthMins, sleepSecs, camera, ap)
print('done')