def __init__(self, port=None, **kwargs): # create the generic interface self.window = ArduinoConsole() # reroute printed output to the console window; this works because there is a write method defined sys.stdout = self.window # add custom interface elements. self.window.addSlider("PWM", self.pwm_slider_moved) self.window.addSlider("Servo", self.servo_slider_moved) self.window.addButton("LED On", self.led_on_button_pressed) self.window.addButton("LED Off", self.led_off_button_pressed) # add a plot window self.window.addScope() self.window.addScopeChannel('A0', color='blue', duration=20) # set up the connect/disconnect control self.window.attachConnectCallback(self._connect_disconnect) # set up the command lin self.window.attachCommandCallback(self._command_input) # fill in the default text field for the Arduino port name if provided if port is not None: self.window.setArduinoPortName(port) # initialize connection state self.portname = port self.port = None self.input_monitor = None self.input_enabled = False self.arduino_time = 0 return