diff --git a/src/pymodaq_plugins_arduino/daq_move_plugins/daq_move_Servo.py b/src/pymodaq_plugins_arduino/daq_move_plugins/daq_move_Servo.py index bb74123..63ee3c1 100644 --- a/src/pymodaq_plugins_arduino/daq_move_plugins/daq_move_Servo.py +++ b/src/pymodaq_plugins_arduino/daq_move_plugins/daq_move_Servo.py @@ -2,11 +2,12 @@ from pymodaq.control_modules.move_utility_classes import (DAQ_Move_base, comon_parameters_fun, main, - DataActuatorType, + DataActuatorType, Q_, DataActuator) from pymodaq_utils.utils import ThreadCommand from pymodaq_gui.parameter import Parameter + from pymodaq_plugins_arduino.hardware.arduino_telemetrix import Arduino from pymodaq_plugins_arduino.utils import Config @@ -27,7 +28,7 @@ class DAQ_Move_Servo(DAQ_Move_base): """ _axis_names = {'Servo': config('servo', 'pin')} - _controller_units = {'Servo': '°'} + _controller_units = {'Servo': ''} _epsilons = {'Servo': 1} data_actuator_type = DataActuatorType['DataActuator'] @@ -66,7 +67,6 @@ def commit_settings(self, param: Parameter): param: Parameter A given parameter (within detector_settings) whose value has been changed by the user """ - ## TODO for your custom plugin pass def ini_stage(self, controller=None): @@ -93,6 +93,12 @@ def ini_stage(self, controller=None): ) self.controller.set_pin_mode_servo(config('servo', 'pin')) + self.emit_status(ThreadCommand('update_ui', attribute='set_abs_value_red', + args=[Q_(config('servo', 'pos_1'), + self.controller_units['Servo'])])) + self.emit_status(ThreadCommand('update_ui', attribute='set_abs_value_green', + args=[Q_(config('servo', 'pos_12'), + self.controller_units['Servo'])])) info = "Whatever info you want to log" initialized = True return info, initialized diff --git a/src/pymodaq_plugins_arduino/resources/config_template.toml b/src/pymodaq_plugins_arduino/resources/config_template.toml index 13b207c..50c49c8 100644 --- a/src/pymodaq_plugins_arduino/resources/config_template.toml +++ b/src/pymodaq_plugins_arduino/resources/config_template.toml @@ -1,15 +1,15 @@ title = "this is the configuration file of the plugin Arduino" -com_port = "COM23" +com_port = "COM24" [presets] preset_for_colorsynthesizer = "ArduinoLED" [LED] [LED.pins] -red_pin = 9 -green_pin = 10 -blue_pin = 11 +red_pin = 6 +green_pin = 4 +blue_pin = 5 [LCD] address = 0x27 @@ -17,4 +17,6 @@ cols = 16 rows = 2 [servo] -pin = 3 \ No newline at end of file +pin = 2 +pos_1 = 55 +pos_2 = 80 \ No newline at end of file