This script makes the Gripper-equipped cyber:bot:
Let's give it a try.
cyber_bot_gripper_forward_object.hex [1]
The script was created by entering the text below into the python.microbit.org/v/2 editor. The cyberbot.py module was also added to the Project Files as shown in Add modules to your micro:bit [3]. The Script Name was set to cyber_bot_gripper_forward_object before saving it as a .hex file as shown in How to Save and Reopen a Script in Python Editor v2 [4].
# cyber_bot_gripper_forward_object from cyberbot import * display.show(Image.ARROW_E) while True: if button_b.was_pressed(): display.clear() bot(16).servo_angle(150) # lower & open gripper sleep(1500) bot(18).servo_speed(130) # Forward 0.5 s bot(19).servo_speed(-130) sleep(500) bot(18).servo_speed(None) bot(19).servo_speed(None) sleep(1000) bot(16).servo_angle(30) # close gripper & lift sleep(1500) bot(18).servo_speed(130) # Forward 1.25 s bot(19).servo_speed(-130) sleep(1250) bot(18).servo_speed(None) bot(19).servo_speed(None) sleep(1000) bot(16).servo_angle(150) # lower & open gripper sleep(1500) bot(18).servo_speed(-130) # Backward 0.5 s bot(19).servo_speed(130) sleep(500) bot(18).servo_speed(None) bot(19).servo_speed(None) display.show(Image.ARROW_E)
Your cyber:bot robot might curve to the left or the right during these maneuvers. If it does, it can be straightened by slowing the servo that’s going faster and causing the curve. A remedy for this is included in the step-by-step instructions below.
Links
[1] https://learn.parallax.com/sites/default/files/content/cyberbot/Gripper/Hex/cyber_bot_gripper_forward_object.hex
[2] https://python.microbit.org/v/2
[3] https://learn.parallax.com/tutorials/robot/cyberbot/add-modules-your-microbit
[4] https://learn.parallax.com/tutorials/robot/cyberbot/how-save-and-reopen-script-python-editor-v2