def initiate_objects(self): self.hub = MSHub() self.hub.status_light.on('orange') self.motor_front = Motor(self.settings['motor_front_port']) self.motor_rear = Motor(self.settings['motor_rear_port']) self.dist_sens = DistanceSensor(self.settings['dist_sens_port'])
from mindstorms import MSHub, Motor, MotorPair, ColorSensor, DistanceSensor, App from mindstorms.control import wait_for_seconds, wait_until, Timer from mindstorms.operator import greater_than, greater_than_or_equal_to, less_than, less_than_or_equal_to, equal_to, not_equal_to import math # driving with Tricky wheel_radius = 2.8 pen_radius = 8.6 axis_radius = 5.6 line_length = 5 # Create your objects here. hub = MSHub() # Write your program here. hub.speaker.beep() motor = Motor('C') motor.run_to_position(165) def pen_up(): motor.run_for_degrees(-90) def pen_down(): motor.run_for_degrees(90)
"77077:00000:99099:99099:00000", "77077:00000:99099:99099:00000", "77077:00000:00000:77077:00000", "77077:00000:00000:00000:00000", "77077:00000:00000:88088:00000", "77077:00000:99099:99099:00000", "77077:00000:99099:99099:00000", "77077:00000:99099:99099:00000", "77077:00000:99099:99099:00000", "77077:00000:99099:99099:00000", "77077:00000:99099:99099:00000", "77077:00000:99099:99099:00000", "77077:00000:99099:99099:00000", ] ms_hub = MSHub() # start test async def on_start(vm, stack): ms_hub.status_light.on("black") rotate_hub_display_to_value("3") blinking_frames = [hub.Image(frame) for frame in blinking_animation] vm.system.display.show(blinking_frames, clear=False, delay=round(1000 / 8), loop=True, fade=1) left_hand = Motor("B") right_hand = Motor("F")