Commit f7dc6e32 authored by Federico Meloda's avatar Federico Meloda

another test with leds

parent 80d3bb7b
......@@ -25,7 +25,7 @@ class Color:
class ColorManager(Thread):
pow_time = 10000
pow_time = 0
current_rand = 1
current_color = Color(0, 0, 0)
stato = 0
......@@ -42,32 +42,23 @@ class ColorManager(Thread):
def get_color(self):
if self.current_color.green + self.current_rand > 80:
if self.current_color.green + self.current_rand > (80-(self.pow_time/4000):
self.current_rand = -randint(1, 8)
self.current_color = Color(80, 255, 30)
self.current_color = Color(80-(50*self.pow_time/10000), 255, 30)
elif self.current_color.green + self.current_rand < 0:
self.current_rand = randint(1, 8)
self.current_color = Color(0, 255, 30)
self.current_color = Color(0, 255, 30-self.pow_time/10000)
else:
self.current_color.green += self.current_rand
self.current_color.red = 255
self.current_color.blue = 30
self.current_color.blue = 30-(30*self.pow_time/10000)
if self.pow_time > 0:
self.pow_time -= 1
def power(self):
if self.current_color.green + self.current_rand > 40:
self.current_rand = -randint(1, 8)
self.current_color = Color(30, 255, 0)
elif self.current_color.green + self.current_rand < 0:
self.current_rand = randint(1, 8)
self.current_color = Color(0, 255, 0)
else:
self.current_color.green += self.current_rand
self.current_color.red = 255
if self.pow_time < 0:
self.stato = 0
else:
self.pow_time -= 1
self.pow_time=10000
self.stato=0
def fade(self):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment