Script
The script will turn the Gripper's standard servo to its 30° position. This will make the Gripper close and lift its paddles. Then it will turn the standard servo to its 150° position to make the Gripper paddles lower and open. If your Gripper does not properly complete both motions, the troubleshooting section on the next page has a script you can run while making mechanical adjustments.
- Right-click the test_gripper_angles_buttons.hex link below, choose Save As, and then save the file to your computer.
test_gripper_angles_buttons.hex
- Open the saved file with the python.microbit.org/v/2 editor.
Note: The script was created by entering the python script below and adding the cyberbot.py module to the Project Files as shown in Add modules to your micro:bit. The Script Name was set to test_gripper_angles_buttons before saving it as a .hex file as shown in How to Save and Reopen a Script in Python Editor v2.
- Plug the battery pack’s barrel plug into the cyber:bot board’s barrel jack.
- Set the cyber:bot board’s PWR switch to 1.
- Click Connect, then Flash.
- Set the PWR switch to 0.
- Disconnect the USB from the cyber:bot robot’s micro:bit module.
Test Script: # test_gripper_angles_buttons
# test_gripper_angles_buttons from cyberbot import * display.show(Image.ARROW_E) while True: if button_b.was_pressed(): bot(16).servo_angle(30) # close gripper & lift display.show(Image.ARROW_W) elif button_a.was_pressed(): bot(16).servo_angle(150) # Lower gripper & open display.show(Image.ARROW_E)
Tests
The main purpose of these tests is to verify that the script makes the Gripper complete both the close/lift and lower/open motions. If it doesn’t do both correctly, try the Troubleshooting section on the next page.
- Set the PWR switch to 2.
- Press/release the micro:bit module’s B button and verify that the Gripper closes and lifts its paddles.
- Press/release the micro:bit module’s A button and verify that the Gripper lowers and opens its paddles.
- If the Gripper does not complete both the close-lift and the lower-open maneuvers, check the Troubleshooting section on the next page.
- When you are done, set the cyber:bot board’s PWR switch to 0. To extend battery life, make sure to do this whenever the cyber:bot with Gripper is not in use.