提问

#楼主# 2018-1-16

跳转到指定楼层
Introduction



In the following, I am going to teach you how to create a cool dazzling colorful two-wheel car with micro:bit. Without complicated algorithm, we only have to make the whole weight center lower than the wheel axle center. Before we start, let's take a look at a video about our car.










Tools & Materials:



2 x Micro:bit Board

1 x 3.7V Battery

2 x 8 RGB Rainbow LED Ring

2 x 360 degree servo(55g)

1 x 8*8 Self-lock Switch

5 x 3*10 Screw

1 x DZ1117 Chip

2 x Servo Wheel

1 x Soldering Iron

1 x Hot Glue Gun



How to Make:



Step 1: Paste the bottom of two servos together.




Step 2Welding electric cables according to schematic diagram in the below.






Step 3: Fix LED rings to the rotating shafts of the servos.






Step 4: Fix battery. ( Battery shall be installed a little bit lower to the bottom of servo. )






Step 5: Fix Micro:bit.



First of all, paste an acrylic board to the surface of the servo so that we can stabilize micro:bit board more conveniently. Match the holes on the acrylic board well with holes on micro:bit board.

To install screws easier, we need to fix the acrylic board a little bit higher.








Step 6: Install two wheels and hide the messy cables to make it looks more pretty.






Now we have completed all of components installation. To make it run, we need to program for it.








Programming



Click to open Microsoft Makecode, write your code into the edit area. I would like to suggest you to program by yourself first.

Of course, you can see the whole program in the link below. Just click
Edit
on the top right corner to edit your program
then click
Download
to store your code into micro:bit.



Code of Car:









Code of Remote Controller:









Code Explain



Code Of Wheel






Set P2 and P1 as control pins for servos. For 360 degree servo, 90 means servo stop rotation, 0 means rotate in clockwise direction with max speed, and 180 means rotate in anti-clockwise direction with max speed. The further it deviates from 90, the faster speed it will have. Move forward or backward, and turn left or right are realized through controlling the rotating direction and speed of two servos.






Respond relative movement to the signal received.






Set P0 as the control pin of RGB light. There are 16 RGB LED lights in total. Their colors are rainbow color.






Make LED colors move in circle.



Code Of Remote Controller






Once vibration detected, remote controller sends number 2.






Press different keys to send relative values.



Operation Method



Press button A, turn left;

Press button B, turn right;

Press button A+B, move forward;

Shake the remote controller, move backward.



Relative Readings:



Make A Cool Micro:bit Hovercraft Together

Micro:bit Experiment 11: Rainbow LED Ring —— Elecfreaks Mirco: bit Starter Kit Course


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

使用道具

成为第一个回答人

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