提问

Make A Micro:bit Car

电子制作  / 倒序浏览   © 著作权归作者本人所有

#楼主# 2018-1-16

跳转到指定楼层
Make your very own self-driving micro:bit car!

(Disclaimer: It's only "self-driving" inasmuch as a ball rolling down a hill is "self-rolling".)

Goals

    [li]
    In this project, we're going to use the Micro:bit, Breakout Board, and Servos to make a self-driving car!
    [/li]
    [li]
    Get to know the Servo and how to use it with the Micro:bit, Breakout Board and MakeCode.
    [/li]
    [li]
    Marvel at how ridiculous this thing is!
    [/li]
Note:

This activity uses extra parts not found in the Tinker Kit.

(Stay tuned to our Online Store for our Car Kit !)

Materials

1 x BBC micro:bit

1 x Micro USB cable

1 x Battery box

2 x AA batteries

1 x Breakout board

2 x Servo

1 x Acrylic car body

2 x Wheels

1 x Felt pad

Sticky tape



Step 1

Connect your car parts as shown in the following pictures.

If you're using our car kit, follow the labels on the car body to insert the components correctly with the sticky tape.

Connect the servo connectors to Pin 0 and Pin 1 on the Breakout Board.

Note that the colours of common servo cables don't match the yellow, red, and black colour scheme of the breakout board exactly. Match the orange servo cable to the yellow pin, and the brown servo cable to the black pin.





Step 2

Add the blocks shown to your On Start block.

What this does? Reset the servos to fixed positions whenever we start!

The Servo block (colored red) in MakeCode takes values from 0 to 180. You can find it under Advanced, then Pins.

For the continuous servos we're using, a value of 90 is right in the middle. In other words, we're telling the servo to \"stay still\".

We display an image to make a visual indication that we've downloaded our code into the Micro:bit.

Step 3

Let's make the wheels move! Add the code shown on the right to your Forever block.

The Digital Write Pin to 0 block is also found under Advanced, Pins.

What's happening here? We're turning one servo clockwise (180), while turning off the other servo. Then, after a short pause, we're turning off the former servo, and turning the latter servo anti-clockwise (0). Remember, 90 is straight ahead!

Why do we need to turn off one servo at a time? That's because of battery power requirements—your micro:bit has trouble in powering both servos at once. If you're interested, you can explore by using a DC motor with an external power source. Or you can email us to find out more!

Make sure to check that your motors are facing the right directions—you can change the travel directions of the motors by swapping the 0 and 180 values.


Success!

When you're ready to run your car, attach your battery pack to your micro:bit, and your car runs ! Besides, you can personalise your car with some craft material to improve its aerodynamic properties! For further extension, you can also hook up an ADKeyboard to control the motors manually, instead of having the car move autonomously.




This article is from TINKERCADEMY: Make A Micro:bit Car

Relative Readings:

Remote Control Everything!


https://www.elecfreaks.com/11330.html
转播转播 分享淘帖
回复

使用道具

成为第一个回答人

B Color Link Quote Code Smilies
Archiver|手机版|小黑屋|MakerTime 创客时代  
Powered by Discuz! X3.3  © 2001-2017 Comsenz Inc.