-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMain.py
More file actions
60 lines (48 loc) · 1.77 KB
/
Main.py
File metadata and controls
60 lines (48 loc) · 1.77 KB
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
#This should be a short version where i can just call functions
from Functions.py import * #Hopefully this imports everything from the fuctions file.
import time
import signal
from neopixel import *
import threading
import Queue
import skywriter
# Settings for your matrix and Pins:
LED_PIN = 18 # GPIO pin connected to the pixels (must support PWM!).
LED_FREQ_HZ = 800000 # Just leave it at this, normally works!
LED_DMA = 5 # DMA channel to use for generating signal (try 5)
LED_BRIGHTNESS = 50 # from 0 to 255, keep it low, you don't want to be blinded
LED_INVERT = False # True to invert the signal (when using NPN transistor level shift)
WIDTH = 12 # How ever many pixels wide your grid is
HEIGHT = 8 # How ever many pixels high your grid is
LED_COUNT = WIDTH * HEIGHT #Is this needed?
strip = Adafruit_NeoPixel(LED_COUNT, LED_PIN, LED_FREQ_HZ, LED_DMA, LED_INVERT, LED_BRIGHTNESS)
global lastLocation
#global lastStep
#lastStep = 0
lastLocation = [0,0,0] #x,y, step
q = Queue.Queue()
@skywriter.move()
def move(x, y, z):
global lastLocation
#r = int(255 * (z / 0.7))
step = 25 - (int(25 * (z)) + 1)
print(z, step)
newLocation = [x, y, step]
#print newLocation
if newLocation != lastLocation:
q.put(newLocation)
lastLocation = newLocation
strip.begin()
#pulse(q)
#Lets try a thread...
t = threading.Thread(target=pulse, args = (q,strip, WIDTH, HEIGHT))
t.daemon = True
t.start()
while True:
signal.pause() #wait for intetrrupt
#Event.wait()
#Take move from skywriter
#import move from skywriter and input into x,y,z co-ordinates
#Give option for mood, create an input of 3 mechanical buttons
#Sad, Happy, excited
#each mood has it's own colour and and key signature