Beispiel #1
0
 def test_can_set_from_simple_settings(self):
     raspi = RasPi(self.mockconfig)
     settings = LightSettings(red=10, green=20, blue=30)
     raspi.apply_settings(settings)
     red, green, blue = raspi.get_current_dutycycles()
     self.assertEquals(10, red)
     self.assertEquals(20, green)
     self.assertEquals(30, blue)
Beispiel #2
0
 def test_can_transition_one_way(self):
     raspi = RasPi(self.mockconfig)
     settings = LightSettings(red=0, green=0, blue=0)
     settings2 = LightSettings(red=255, green=255, blue=255)
     settings.next_settings = settings2
     settings.on_duration = 0.015
     settings2.transition_time = 0.015
     raspi.apply_settings(settings)
     for led in raspi.leds:
         self.assertEquals(0, raspi.get_PWM_dutycycle(led))
     gevent.sleep(0.07)
     for led in raspi.leds:
         self.assertEquals(255, raspi.get_PWM_dutycycle(led))