]>
vault307.fbx.one Git - Sensory_Wall.git/blob - 5vLEDcontroller.py
1 import us100
, machine
, neopixel
, time
2 # TODO adjust pin #s to match soldered connections, adjust distance trigger, _thread?
3 btn
=machine
.Pin(15, machine
.Pin
.IN
,machine
.Pin
.PULL_UP
)
4 light
=machine
.Pin(1,machine
.Pin
.OUT
)
5 np
=neopixel
.NeoPixel(machine
.Pin(0), 96)
6 sensor
=us100
.US100UART(machine
.UART(1))
13 distance
=sensor
.distance()
22 def fade(): #pick color
23 for i
in range(0,4 * 256,8):
25 if (i
// 256) % 2 == 0:
28 val
= 255 - (i
& 0xff)
32 #colorcycle, does start over, do only i actually care about that? probably
35 return(pos
*3,255-pos
*3,0)
38 return(255-pos
*3,0,pos
*3)
41 return(0,pos
*3,255-pos
*3)
44 global position
, brightness
47 hue
=int(i
*(255/np
.n
)+position
)%256
49 color
=tuple(int(val
*brightness
) for val
in color
)
50 np
[(i
+position
)%np
.n
]=color
52 position
=(position
+1)% np
.n
61 print("idk, something went wrong man")
64 main loop, hell yeah! throw them built funcs here!