Skip to content

Commit

Permalink
added all animations from acab2 machine
Browse files Browse the repository at this point in the history
  • Loading branch information
saerdnaer committed Nov 5, 2016
1 parent a498de8 commit 986a859
Show file tree
Hide file tree
Showing 24 changed files with 686 additions and 160 deletions.
Empty file added animations/__init__.py
Empty file.
27 changes: 27 additions & 0 deletions animations/black-wall.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import acabsl
import time
t = 1

acabsl.update()

def set_all_wall(r,g,b):
acabsl.set_target("127.0.0.1",6002)
for w in range(acabsl.NOOFWALLS):
for x in range(acabsl.WALLSIZEX):
for y in range(acabsl.WALLSIZEY):
acabsl.send(x,y,r,g,b,1,w)
acabsl.update()

def set_wall_to_black():
set_all_wall(0,0,0)
time.sleep(t)

def main():
while 1:
set_wall_to_black()

if __name__ == '__main__':
main()
2 changes: 1 addition & 1 deletion animations/black.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def set_all(r,g,b):
for w in range(acabsl.NOOFWALLS):
for x in range(acabsl.WALLSIZEX):
for y in range(acabsl.WALLSIZEY):
acabsl.send(x,y,r,g,b,0,w)
acabsl.send(x,y,r,g,b,1,w)
acabsl.update()

while 1:
Expand Down
33 changes: 33 additions & 0 deletions animations/blackAllTheThings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import acabsl
import time
t = 1

acabsl.update()

def set_all(r,g,b):
acabsl.set_target("127.0.0.1",6002)
for w in range(acabsl.NOOFWALLS):
for x in range(acabsl.WALLSIZEX):
for y in range(acabsl.WALLSIZEY):
acabsl.send(x,y,r,g,b,1,w)
acabsl.update()
acabsl.set_target("127.0.0.1",8002)
for w in range(acabsl.NOOFWALLS):
for x in range(acabsl.WALLSIZEX):
for y in range(acabsl.WALLSIZEY):
acabsl.send(x,y,r,g,b,1,w)
acabsl.update()

def set_all_to_black():
set_all(0,0,0)

def main():
while 1:
set_all_to_black()
time.sleep(t)

if __name__ == '__main__':
main()
22 changes: 22 additions & 0 deletions animations/black_decke.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import acabsl
import time
t = 1

acabsl.update()

def set_all(r,g,b):
for w in range(1):
for x in range(2):
for y in range(12):
acabsl.send(x,y,r,g,b,1,1)
acabsl.update()

while 1:
set_all(0,0,0)
time.sleep(t)



2 changes: 1 addition & 1 deletion animations/dropping.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import random
import time

tick = 0.3
tick = 1.8

def setcol(col, r, g, b, rtime):
for i in range(0,acabsl.WALLSIZEY):
Expand Down
4 changes: 2 additions & 2 deletions animations/enerystar.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ def turn_off():
global turned_off
turned_off = True

schedule.every().day.at("18:00").do(turn_on)
schedule.every().day.at("06:00").do(turn_off)
schedule.every().day.at("16:00").do(turn_on)
schedule.every().day.at("08:00").do(turn_off)

while 1:
schedule.run_pending()
Expand Down
2 changes: 1 addition & 1 deletion animations/gameoflife.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import random
import time

tick = .5
tick = 2
maxX = acabsl.WALLSIZEX
maxY = acabsl.WALLSIZEY
aliveC = [0,255,0]
Expand Down
21 changes: 21 additions & 0 deletions animations/green.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/python

import acabsl
import time
t = 1

acabsl.update()

def set_all(r,g,b):
for w in range(acabsl.NOOFWALLS):
for x in range(acabsl.WALLSIZEX):
for y in range(acabsl.WALLSIZEY):
acabsl.send(x,y,r,g,b,0,w)
acabsl.update()

while 1:
set_all(0,255,0)
time.sleep(t)



2 changes: 1 addition & 1 deletion animations/multiwall_fullpulse.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

NOOFWALLS=2

tick = 0.5
tick = 2

def set(r,g,b,time):
for x in range(acabsl.WALLSIZEX):
Expand Down
2 changes: 1 addition & 1 deletion animations/multiwall_rainbowscroll.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import random
import time

tick = 0.2
tick = 3.7

def setcol(col, r, g, b, time):
for wall in range(acabsl.NOOFWALLS):
Expand Down
39 changes: 39 additions & 0 deletions animations/python-banner.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from acabsl import send
from acabsl import update
import acabsl

import colorsys
import random
import time

tick = 0.8

def setdata(data, time):
for x in range(0,acabsl.WALLSIZEX):
for y in range(0,acabsl.WALLSIZEY):
r,g,b = colorsys.hsv_to_rgb(data[x][y], 1., 1.)
send(x,y,r*255,g*255,b*255,time);
update()

def shift(l,n):
return l[n:] + l[:n]

f = 0.66
b = 0.16
data = [
[f,f,b, b, b,b,b, b, b,f,b ,b ,f,b,b ,b ,b,b,b ,b ,b,b,b ,b,b,b],
[f,b,f, b, f,b,f, b, b,f,b ,b ,f,f,b ,b ,b,f,b ,b ,f,f,b ,b,b,b],
[f,f,b, b, f,b,f, b, f,f,f ,b ,f,b,f ,b ,f,b,f ,b ,f,b,f ,b,b,b],
[f,b,b, b, f,b,f, b, b,f,b ,b ,f,b,f ,b ,f,b,f ,b ,f,b,f ,b,b,b],
[f,b,b, b, b,f,b, b, b,f,b ,b ,f,b,f ,b ,b,f,b ,b ,f,b,f ,b,b,b],
[b,b,b, b, f,b,b, b, b,b,b ,b ,b,b,b ,b ,b,b,b ,b ,b,b,b ,b,b,b]
]
data = zip(*data)
update()
while 1:
data = shift(data,1)
setdata(data, 0.1)
time.sleep(tick)

33 changes: 33 additions & 0 deletions animations/rainbowscroll-slow.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from acabsl import send
from acabsl import update
import acabsl

import colorsys
import random
import time

tick = 2.6

def setcol(col, r, g, b, time):
for i in range(0,acabsl.WALLSIZEY):
send(col,i,r,g,b,time);
update()

h = 0
col = 0
update()
while 1:
h += random.gauss(0.02,0.05)
h = h % 1.

col += 1
col = col % acabsl.WALLSIZEX

r,g,b = colorsys.hsv_to_rgb(h, 1., 1.)
setcol(col, r*255, g*255, b*255, tick*3)

time.sleep(tick)


32 changes: 32 additions & 0 deletions animations/rand.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/python

import acabsl
import time
import random

t = 2.5

acabsl.update()

def set_all(r,g,b):
for w in range(acabsl.NOOFWALLS):
for x in range(acabsl.WALLSIZEX):
for y in range(acabsl.WALLSIZEY):
acabsl.send(x,y,r,g,b,0,w)
acabsl.update()


def set_random(r,g,b):
for w in [random.choice(range(acabsl.NOOFWALLS))]:
for x in [random.choice(range(acabsl.WALLSIZEX))]:
for y in [random.choice(range(acabsl.WALLSIZEY))]:
acabsl.send(x,y,r,g,b,0,w)
acabsl.update()


while 1:
set_all(0,0,0)
#set_random(255,0,0)
set_random(random.choice(range(0,255)),random.choice(range(0,255)),random.choice(range(0,255)))
time.sleep(t)

2 changes: 1 addition & 1 deletion animations/red-sym-scroll.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import acabsl
import time
t = .3
t = 1.8

acabsl.update()

Expand Down
21 changes: 21 additions & 0 deletions animations/red.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/python

import acabsl
import time
t = 1

acabsl.update()

def set_all(r,g,b):
for w in range(acabsl.NOOFWALLS):
for x in range(acabsl.WALLSIZEX):
for y in range(acabsl.WALLSIZEY):
acabsl.send(x,y,r,g,b,0,w)
acabsl.update()

while 1:
set_all(255,0,0)
time.sleep(t)



2 changes: 1 addition & 1 deletion animations/s-color4-faster.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import time
import math

tick = 0.15
tick = 1.65

def setcol(col, r, g, b, time):
for i in range(0,6):
Expand Down
2 changes: 1 addition & 1 deletion animations/s-color4.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import time
import math

tick = 0.4
tick = 1.9

def setcol(col, r, g, b, time):
for i in range(0,6):
Expand Down
75 changes: 75 additions & 0 deletions animations/schnitzel.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
#!/usr/bin/python

import acabsl
import time
import serialinterface
import sys
import random

print sys.argv[1]

serial = serialinterface.SerialInterface(sys.argv[1],115200,1)

t = 1

acabsl.update()

def set_all(r,g,b):
for w in range(acabsl.NOOFWALLS):
for x in range(acabsl.WALLSIZEX):
for y in range(acabsl.WALLSIZEY):
acabsl.send(x,y,r,g,b,0,w)

def set_pattern():
set_all(0,0,0)
r = random.random()*127+127
g = random.random()*127+127
b = random.random()*127+127

acabsl.send(5,0,r,g,b)
acabsl.send(5,0,r,g,b)
acabsl.send(7,0,r,g,b)
acabsl.send(8,0,r,g,b)
acabsl.send(9,0,r,g,b)
acabsl.send(0xA,0,r,g,b)
acabsl.send(0xD,0,r,g,b)


acabsl.send(6,1,r,g,b)
acabsl.send(8,1,r,g,b)
acabsl.send(9,1,r,g,b)
acabsl.send(0XC,1,r,g,b)

acabsl.send(6,2,r,g,b)
acabsl.send(8,2,r,g,b)
acabsl.send(0xB,2,r,g,b)
acabsl.send(0xC,2,r,g,b)


acabsl.send(5,3,r,g,b)
acabsl.send(5,3,r,g,b)
acabsl.send(7,3,r,g,b)
acabsl.send(0xA,3,r,g,b)
acabsl.send(0xC,3,r,g,b)
acabsl.send(0xD,3,r,g,b)
acabsl.send(0xE,3,r,g,b)

acabsl.send(0x8,4,r,g,b)
acabsl.send(0x9,4,r,g,b)
acabsl.send(0xB,4,r,g,b)

t0 = 0
while 1:
#channel, message = serial.readMessage()
message = serial.readMessage()
#print channel, message
#if channel and message == 'bar':
if message == 'bar':
if time.time() - t0 > 1:
set_pattern()
acabsl.update()
t0 = time.time()
#time.sleep(1)



Loading

0 comments on commit 986a859

Please sign in to comment.