yahboom
HomeLearn
Solution
Blog
Online Store
About Us
EN/中文
Tiny:bit Robot Car📖
1.First Trial
  • 1.1 First Trial
  • 1.2 Bluetooth APP manual matching tutorial
2.Preparation before programming
About Graphical
  • 1.Online programming
  • 2.Offline programming
About Python
  • 1.Python Programming
  • 2.Import Tiny:bit library
  • 3.Tiny:bit MicroPython API
Download program
  • How to download program
3.Lighting with Tiny bit
  • 3.1 LED light
  • 3.2 RGB Searching light
  • 3.3 RGB light exchange lighting
  • 3.4 LED light exchange lighting
  • 3.5 Breathing light
4.Singing withTiny bit
  • 4.1 Playing internal music
  • 4.2 Play Merry Christma with lights
5.Running with Tiny bit
  • 5.1 Advance
  • 5.2 CarRun
  • 5.3 Control speed
  • 5.4 Dancer
  • 5.5 Route plan
6.Playing with Tiny bit
  • 6.1 Measuring worker
  • 6.2 Distance control light
  • 6.3 Ultrasonic obstacle avoidance
  • 6.4 Magic hand
  • 6.6 Playing black paino
  • 6.7 Tracking
  • 6.8 Voice control light
  • 6.9 Coward
  • 6.10 Musical rhythm
  • 6.11 Listener
  • 6.12 Wobble when touch
  • 6.13 Spinning top
  • 6.14 Frog beating
  • 6.15 Adventure car
7.Interacting with Tiny bit
  • 7.1 IR Control
  • 7.2 Android bluetooth APP control
  • 7.3 iOS bluetooth APP control
  • 7.4 Handle remote control
  • 7.5 WiFi camera control(Tinybit Plus)
8.Charging and battery
  • Charging and Battery
9.Python course
Basic course
  • 1.Hello,World
  • 2.Display built-in image
  • 3.Display custom image
  • 4.Display custom animation
  • 5.Button game
  • 6.Play built-in music
  • 7.Car Headlights
  • 8.Drive Motor
  • 9.Tracking
  • 10.Sound sensor
  • 11.Ultrasonic
  • 12.IR control
  • 13.LED light
Robot course
  • 1.Advance
  • 2.CarRun
  • 3.Control speed
  • 4.Route plan
  • 5.Distance control light
  • 6.Ultrasonic avoid
  • 7.Tracking
  • 8.Voice control light
  • 9.Listener
  • 10.IR control
  • 11.Handle control(option)
10.AI vision course(For Tiny:bit Plus)new
  • 1. Cat(dog) detection
  • 2. Color recognition
  • 3. QR code instructions
  • 4. Person Recognition
  • 5. Face Detection
  • 6. Color Follows
  • 7. Face following
Download
  • APP(iOS_Android)
  • Instruction_Manual
  • Code
  • Makecode offline software
  • Bluetooth Remote Control with ultrasonic V2.hex
  • Bluetooth Remote ControlV1.5.hex
  • Bluetooth Remote Control with ultrasonicV1.5.hex
  • IR control V2.hex
  • IR control V1.5.hex
  • Tiny:bit V1 MicroPython Library
  • Tiny:bit V2 MicroPython Library
  • Tiny:bit MicroPython API
  • Bluetooth communication protocol
Download ZIP
FAQ
  • 1、Can't open MakeCode software normally.
  • 2、Tiny:bit Expansion pack infrared cannot switch French

Welcome to Tiny:bit Robot Car repository

当製品の日本語版マニュアル資料は、こちらからご取得ください。

7.Tracking


! Note: This experiment must be done indoors to reduce the interference of sunlight on the infrared sensor.

Learning goal:

In this lesson, we will learn how to get infrared tracking sensor data, and use the detected data to go along the black line.

Principle of experimental:

The basic principle of the tracking sensor is to use the reflective nature of the object.

Our experiment is to tracking the black line. When the infrared light is emitted to the black line, it will be absorbed by the black line. When the infrared light is emitted to the other color line, it will reflected to the infrared receiver tube.

Position of tracking sensor as shown below:

image.png  

Code:

image.png 

1) Import the library needed for this lesson from micro:bit, display is used for dot matrix display, Image calls the built-in image, pin12 is the pin of the body colorful lights, neopixel drives the body colorful lights, and tinybit controls the car.

2) display.show (Image.HAPPY): Display a smile on micro:bit dot matrix.

3) np = neopixel.NeoPixel (pin12, 2): Initialize the body colorful lights. The first parameter is the pins connected to the lights, and the second parameter is the total number of RGB lights.

4) np.clear (): Clear the body colorful lights.

5) tinybit.car_HeadRGB (0, 0, 0): Clear the head RGB searchlight.

6) display.show(Image.HEART):Display a heart on micro:bit dot matrix.

7) left = tinybit.traking_sensor_L():Read the data from the left tracking sensor, return True when a black line is detected, return False when a white line is detected, and save the read result to the variable left.

8) right = tinybit.traking_sensor_R():Read the data from the right tracking sensor, return True when a black line is detected, return False when a white line is detected, and save the read result to the variable right.

Analysis of car tracking status:

image.png 

9) Determine the values of the variables left and right in the main loop, and analyze the movement of the car according to the figure above:

If both the left and right sensors do not detect the black line, the car moves forward;

If a black line is detected on the left and a black line is not detected on the right, the car spin left;

If no black line is not detected on the left and a black line is detected on the right, the car will spin right;

In other cases, if both sensors of the cart detect a black line, the car stop.

Programming and downloading:

1.You should open the Mu software, and enter the code in the edit window, , as shown below.

Note! All English and symbols should be entered in English, and the last line must be a space.

image.png 

2.You can click the “Check” button to check if our code has an error. If a line appears with a cursor or an underscore, the program indicating this line is wrong.

image.png 

3.Click “REPL” button,check whether the tinybit library has been downloaded. If not, please refer to the [preparation before class]---> [Python programming]

image.png 

4.Click the “Flash” button to download the program to micro:bit board.

image.png 

If the program is wrong or the experimental phenomenon is wrong after downloading, please confirm whether you have downloaded the Buildingbit libraryhex file we provided to the micro: bit board.

For the specific method of adding library files, please refer to 【1.Preparation before class】---【Python programming】

Experimental phenomena:

After download is complete, open the power switch. Micro:bit will display a heart on dot matrix. Put Tiny:bit on the track with black line on white background (we can also stick a circle with black tape on white ground (or on white paper)), the car will follow the track of the track. If the car is picked up without detecting anything else, it will stop.

image.png


Ultrasonic avoid
Voice control light

COMPANY

  • About us
  • Team Style
  • Blog

LEARNING & EXPLORATION

  • Tutorials
  • Edge AI hardware
  • Educational robots
  • Embedded intelligent hardware

WHERE TO BUY

  • Yahboom Online Store
  • Amazon
  • Alibaba
  • AliExpress
  • Mercado

TECHNOLOGY SUPPORT

  • Email: support@yahboom.com

BE A DISTRIBUTOR

  • Email: sales@yahboom.com
QR Code

Copyright © 2017-2026 Yahboom. All Rights Reserved.

EN/中文