Start the motor to rotate
from m5stack import *
from m5stack_ui import *
from uiflow import *
import unit
screen = M5Screen()
screen.clean_screen()
screen.set_screen_bg_color(0xFFFFFF)
roller485_0 = unit.get(unit.ROLLER485, unit.PORTA)
roller485_0.init_device(0, 0x64)
roller485_0.set_motor_mode(1)
roller485_0.set_motor_output_state(1)
while True:
roller485_0.set_motor_speed_current_setting(1000, 400)
roller485_0.set_motor_speed_pid(15, 0.0001, 400)
wait_ms(2)
roller485_0.init_device(0, 0x64)
print((str('spec:') + str((roller485_0.get_device_spec(0xFE)))))
print((str('count value:') + str((roller485_0.get_encoder_value()))))
print((str('485 baudrate:') + str((roller485_0.get_485_baudrate()))))
print((str('current mode:') + str((roller485_0.get_motor_mode()))))
print((str('readback value:') + str((roller485_0.get_motor_current_readback()))))
print((str('error code:') + str((roller485_0.get_motor_error_code()))))
print((str('485 id:') + str((roller485_0.get_motor_id()))))
print((str('speed max current setting value:') + str((roller485_0.get_motor_speed_max_current()))))
print((str('output status:') + str((roller485_0.get_motor_output_status()))))
print((str('position max current setting value:') + str((roller485_0.get_motor_position_max_current()))))
print((str('position pid:') + str((roller485_0.get_motor_position_pid()))))
print((str('readback value:') + str((roller485_0.get_motor_position_readback()))))
print((str('position setting value:') + str((roller485_0.get_motor_position_setting()))))
print((str('speed max current setting value:') + str((roller485_0.get_motor_speed_max_current()))))
print((str('speed id:') + str((roller485_0.get_motor_speed_pid()))))
print((str('readback value:') + str((roller485_0.get_motor_speed_readback()))))
print((str('setting value:') + str((roller485_0.get_motor_speed_setting()))))
print((str('brightness:') + str((roller485_0.get_rgb_brightness()))))
print((str('RGB color:') + str((roller485_0.get_rgb_color()))))
print((str('RGB mode:') + str((roller485_0.get_rgb_mode()))))
print((str('temperature:') + str((roller485_0.get_temperature_value()))))
print((str('voltage:') + str((roller485_0.get_vin_value()))))
roller485_0.set_button_change_mode(0)
roller485_0.set_data_save_in_flash()
roller485_0.set_encoder_value(1000)
roller485_0.set_i2c_address(0x64)
roller485_0.set_485_baudrate(0)
roller485_0.set_motor_id(0x01)
roller485_0.set_motor_max_current(400)
roller485_0.set_motor_mode(1)
roller485_0.set_motor_output_state(1)
roller485_0.set_motor_position_current_setting(1000, 400)
roller485_0.set_motor_position_pid(15, 0.0001, 400)
roller485_0.set_motor_speed_current_setting(1000, 400)
roller485_0.set_motor_speed_pid(15, 0.0001, 400)
roller485_0.set_motor_over_range_protect(0)
roller485_0.set_remove_protect()
roller485_0.set_rgb_brightness(50)
roller485_0.set_rgb_color((0xff0000))
roller485_0.set_rgb_mode(0)
roller485_0.set_motor_stall_protect(0)