Ejemplo n.º 1
0
	def interp(self):
		led = devices.get_out(self.device_name)
		if not isinstance(led, devices.Led):
			devices.error('device {} is the wrong type'.format(led))
		dc = led.dc
		freq = led.freq
		#led.change_frequency(0.5)
		led.change_frequency(1.0 / self.blink_interval.interp())
		led.change_duty_cycle(50)
		time.sleep(self.blink_interval.interp() * self.number_of_blinks.interp())
		led.change_duty_cycle(dc)
		led.change_frequency(freq)
		"""
Ejemplo n.º 2
0
	def interp(self):
		servo = devices.get_out(self.device_name)
		if not isinstance(servo, devices.Servo):
			devices.error('Device {} is the wrong type'.format(servo))
		servo.set_angle(self.val.interp())
Ejemplo n.º 3
0
	def interp(self):
		led = devices.get_out(self.device_name)
		if not isinstance(led, devices.Led):
			devices.error('device {} is the wrong type'.format(led))
		led.set(self.val.interp())
Ejemplo n.º 4
0
	def interp(self):
		light = devices.get_in(self.device_name)
		if not isinstance(light, devices.LightSensor):
			devices.error('device {} is the wrong type'.format(button))
		light.wait_for_press()
Ejemplo n.º 5
0
	def interp(self):
		light = devices.get_in(self.device_name)
		if not isinstance(light, devices.LightSensor):
			devices.error('device {} is the wrong type'.format(light))
		return light.input()
Ejemplo n.º 6
0
	def interp(self):
		button = devices.get_in(self.device_name)
		if not isinstance(button, devices.Button):
			devices.error('device {} is the wrong type'.format(button))
		button.wait_for_press()
Ejemplo n.º 7
0
	def interp(self):
		button = devices.get_in(self.device_name)
		if not isinstance(button, devices.Button):
			devices.error('device {} is the wrong type'.format(button))
		return button.input()
Ejemplo n.º 8
0
	def interp(self):
		rgb_led = devices.get_out(self.device_name)
		if not isinstance(rgb_led, devices.RgbLed):
			devices.error('device {} is the wrong type'.format(self.device_name))
		rgb_led.set_rgb(self.r.interp(), self.g.interp(), self.b.interp())
Ejemplo n.º 9
0
	def interp(self):
		sensor = devices.get_in(self.device_name)
		if not isinstance(sensor, devices.TemperatureHumiditySensor):
			devices.error('device {} is the wrong type'.format(sensor))
		return sensor.getHumidity()
Ejemplo n.º 10
0
	def interp(self):
		fake = devices.get_in(self.device_name)
		if not isinstance(fake, devices.FakeInput):
			devices.error('device {} is the wrong type'.format(fake))
		return fake.get()