-
Notifications
You must be signed in to change notification settings - Fork 1
/
happy-halloween.py
63 lines (54 loc) · 1.89 KB
/
happy-halloween.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/usr/bin/python
# _ .-') .-') _ .-') .-') _ ('-. _ .-')
#( '.( OO )_ ( OO ) ) ( OO ). ( OO) ) _( OO)( \( -O )
# ,--. ,--.).-'),-----. ,--./ ,--,' (_)---\_)/ '._(,------.,------.
# | `.' |( OO' .-. '| \ | |\ / _ | |'--...__)| .---'| /`. '
# | |/ | | | || \| | )\ :` `. '--. .--'| | | / | |
# | |'.'| |\_) | |\| || . |/ '..`''.) | | (| '--. | |_.' |
# | | | | \ | | | || |\ | .-._) \ | | | .--' | . '.'
# | | | | `' '-' '| | \ | \ / | | | `---.| |\ \
# `--' `--' `-----' `--' `--' `-----' `--' `------'`--' '--'
# IN A BOX
#
# Find more information about this project at
# https://github.com/hevnsnt/monster
#
import pygame
import RPi.GPIO as GPIO
import time
import os, sys, monster
def mouth(opentime):
'''This function moves the mouth up and down'''
GPIO.output(14, GPIO.LOW)
time.sleep(opentime)
GPIO.output(14, GPIO.HIGH)
time.sleep(0.1)
def halloween():
mouth(.353)
mouth(.286)
mouth(.329)
mouth(.351)
mouth(.873)
mouth(.290)
mouth(.241)
mouth(.291)
mouth(.230)
mouth(2.334)
if __name__ == "__main__": # execute only if run as a script
try:
os.system('cls' if os.name == 'nt' else 'clear')
os.system("cat monster.txt") # This is the easist way I know how to do this. CHANGE MY MIND
monster.gpiosetup()
pygame.mixer.init()
pygame.mixer.music.load("audio/Happy_Halloween.mp3")
pygame.mixer.music.play(-1)
time.sleep(2)
halloween()
GPIO.cleanup()
# End program cleanly with keyboard
except KeyboardInterrupt:
GPIO.cleanup()
print("\n[--EXIT--] Monster in a box complete")
print(" Find more information about this project at")
print(" [[ https://github.com/hevnsnt/monster ]]")
print("")