예제 #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)
		"""
예제 #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())
예제 #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())
예제 #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()
예제 #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()
예제 #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()
예제 #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()
예제 #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())
예제 #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()
예제 #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()