示例#1
0
TooLittle = Sound('TooLittle.wav')
TooMuch = Sound('TooMuch.wav')
PARTYTYME = Sound('Talking.wav')

lid = Lid(18, 2)
lid.Open()
time.sleep(2)  #Gi litt tid saa arduinoen faar startet opp.
lid.Close()

######################## PROGRAMSTART #######################
while TestMode:

    ######### INTRO ###############

    Arduino.ShowFace(5)
    Down.Play()
    time.sleep(1)
    Arduino.ShowFace(8)
    time.sleep(1)
    Arduino.StartStopBlink()
    Arduino.ShowFace(3)

    ######### TEST 1 ##############

    test1Magnet.On()

    while not (test1Solution.Exist()):
        print('No solution')
    print('Solution found')

    ######### INTRO TEST 2 ########
示例#2
0
GPIO.add_event_detect(15, GPIO.RISING, callback=Edgedetect)
GameDone = 4
GPIO.setup(GameDone, GPIO.OUT)
GPIO.output(GameDone, False)

################## PRETEST OG TEGN TIL PROGRAMSTART ##########

lid.Open()
time.sleep(5)  #Gi litt tid saa arduinoen faar startet opp skikkelig
lid.Close()

################## BAKGRUNNSMUSIKK TIL JOBBING #####################

if Jazzmode:  #Jazzmodus for folk som liker jazz og Whiplash-sangen
    jazz = Sound('Whiplash.wav')
    jazz.Play(-1)

if Salsamode:  #Salsamode!!!!!!!!
    salsa = Sound('Salsa.wav')
    salsa.Play(-1)

################## RESET GAME OG GAMESTART FUNKSJON #######################


def Gamestart(
):  #Funksjon som returnerer verdien paa pin 14. Er bare saa koden blir litt lettere aa lese. Pin 14 er "start spill" knappen. Det er den hvite knappen bak til hoyre.
    return GPIO.input(14)


def ResetGame():
    test1Magnet.Off()