Micro:bit Simple Remote Gripper of Manipulator
micro:bit x 2
Nezha expansion board x 1
Joystick:bit V2 x 1
360° servos x 3
Bricks x N
AAA battery x 2
Connect the micro:bit to the Nezha expansion board and connect the three servos to S1, S2 and S3 accordingly.
Build them as the picture shows:
Go to MakeCode editor:（https://makecode.microbit.org/#editor）
Add the Planet X package by clicking the settings on the right upper side.
Search with “Joystick:bit”to add the package.
Add Nezha package in the same way.
After completing the packages, go the the coding page:
Remote control end:
Initialize the Joystick:bit and set the radio group in 99 in the on start brick.
Judge the detected value of the joystick:bit, if the returned value of X is less than 200, set the radio send number as 1; If the returned value of X is over 800, set the radio send number as 2; If the returned value of Y is less than 200, set the radio send number as 4; if the returned value of Y is over 800, set the radio send number as 3.
Judge the status of the button C and D, while button C being pressed, set the radio send number as 5; while button D being pressed, set the radio send number as 6.
Gripper of Manipulator
Create variables X,Y,K and set the value all in 180, then set the radio group as 99.
Save the received number as the variable i.
In the forever brick, judge the value of the variable “i”, if it’s 1, set the value of the variable “x”as “x-1”, then judge if the value “X”is less than 0. If yes, set “x”as 0. After that, set the 360° servos connecting to S3 to rotate with the equivalent angles given by the value of “x”. Make sure if “x”is less than 0, the servos get back to 360° from 0°.
Program in the same way to control the movement of the gripper.
Judge the value of the variable “I”, if it’s 5, set the 360° servo connecting to S1 to rotate to 270°; if it’s 6, set the 360° servo connecting to S1 to rotate to 180°. After that, set the variable‘i’as 0, make sure if there is no new signals being updated, it repeatedly executes the former code.
It is able to control the movement of the gripper such as rotation, lift up/down, gripping or loosen by the Joystick:bit or the button C&D.
Share this post
About the Author
ELECFREAKS focuses on microbit and publishes interesting articles
- Micro bit supplier
- Wholesale Suppliers
- Micro bit tutorial
- Micro bit classroom pack
- Mcorbit Environment Monitoring
- TPBot car
- Micro:bit car
- AI Lens
- Micor:bit AI Lens
- Micro:bit LEDs
- BBC micro:bit
- Micro:bit Manipulator
- Wukong board
- Micro:bit Motorcycle
- Nezha breakout
- Micro:bit DIY
- 360° servos
- AI Lens
- Retro Arcade
- Microbit programming
- Do your:bit
- Rainbow LED Ring
- Wonder Building Kit
- Laser Engraver Tutorial