AI and Micro:bit Magical Adventure: Let's Make Our Robot Move!
Welcome to this magical world of programming, kids! Today we're going to learn how to use Micro:bit and AI together to control our Plenbit robot. Are you ready? Let's begin!
Step 1: Meet Our Programming Friends
- Micro:bit: Our small computer with an LED screen
- Plenbit: Our obedient robot friend
- AI: A super smart computer brain that sends instructions
- YunDo: A tool that helps AI and Micro:bit communicate
Step 2: Open the MakeCode Programming Environment
Click the "Open MakeCode" button on the page to enter our programming studio.
Step 3: Create the Main Program Loop
- Find the "Basic" category in the toolbar
- Drag the "forever" block to the programming area
Step 4: Set Up YunDo Connection Response
- Find the "on YunDo connected" block in the "YunDo" category
- Drag it to the programming area
- Place a "show icon" block inside it and choose a smiley face icon
Step 5: Write the Program to Receive Instructions
- Find the "on YunDo data received" block
- Drag it to the programming area
Step 6: Handle the "HEART" Instruction
- Find the "if...then" block in the "Logic" category
- Place it inside the "on YunDo data received" block
- Set the condition to "received data = HEART"
- Place a "show icon" block inside and choose a heart pattern
Step 7: Handle the "MOVE" Instruction
- Add an "else if" block
- Set the condition to "received data = MOVE"
- Place a "show icon" block inside and choose an arrow pattern
- Add a "Plenbit walk forward" block below (found in the "Plenbit" category)
Step 8: Handle Other Instructions
- Add an "else" block
- Place a "show string" block inside
- Set the display content to the received data
Congratulations! You've completed the programming. Now your Micro:bit can follow AI instructions.
Tips:
- If you encounter anything you don't understand, don't forget to click the AI assistant button in the bottom right corner. It will be happy to answer your questions!
- Try changing the heart or arrow patterns to make your program more unique.
- Think about what other fun instructions you could add?
Challenge:
Can you make the Plenbit robot dance? Try adding new instructions and actions to your program!
Remember, programming is like learning magic - it takes practice and patience. Don't get discouraged if you face difficulties. Ask the AI assistant or try a few more times on your own. You'll definitely become an amazing programming wizard!
Happy coding! If you have any questions, feel free to ask the AI assistant anytime!