Tanks, with their tracked structures, are vehicles that can easily move on rough terrains. Tracks consist of multiple sequential wheels or rollers surrounded by a belt.
The PicoBricks Mars Explorer Car is a wooden project kit that utilizes two DC motors and a tracked platform. This robot car, controllable remotely with a remote controller thanks to the IR receiver, can decide on its movements by detecting surrounding objects through the front of its distance sensor.
In this project, we will control two DC motors that connected to motor driver by using IR receiver on the PicoBricks wireless module with the remote controller. The robot car moves in the desired direction thanks to the DC motors. The robot car moves in the desired direction thanks to the DC motors. Additionally, if the HC-SR04 distance sensor on the robot car kit detects an object within 15 cm, the robot car will stop.
Connection Diagram:
You can prepare this project by breaking PicoBricks modules at proper points.
Project Images:
Setup Steps of The Project
MakeCode Code of The Project
Python Code of The Project:
#Mars Explorer Project
from microbit import *
from picobricks import *
# Function Initialization
motor = motordriver()
pin15.set_pull(pin15.PULL_UP)
ir = IRM()
motor.dc(1,0,1)
motor.dc(2,0,1)
def forward():
motor.dc(1,255,1)
motor.dc(2,255,1)
def backward():
motor.dc(1,255,0)
motor.dc(2,255,0)
def left():
motor.dc(1,0,1)
motor.dc(2,255,1)
def right():
motor.dc(1,255,1)
motor.dc(2,0,1)
def stop():
motor.dc(1,0,1)
motor.dc(2,0,1)
def left_image():
display.show(Image('00900:'
'09000:'
'99999:'
'09000:'
'00900'))
def right_image():
display.show(Image('00900:'
'00090:'
'99999:'
'00090:'
'00900'))
def up_image():
display.show(Image('00900:'
'09990:'
'90909:'
'00900:'
'00900'))
def down_image():
display.show(Image('00900:'
'00900:'
'90909:'
'09990:'
'00900'))
while True:
distance = measure_distance()
#print(distance)
key=ir.get(pin15)
if(key!=-1):
print(key)
if key == 24:
if distance<=15:
stop()
else:
forward()
down_image()
elif key == 90:
right()
right_image()
elif key == 8:
left()
left_image()
elif key == 82:
backward()
up_image()
#sleep(100)
else:
stop()
print(key)
display.show(Image.HAPPY)
MicroBlocks Code of The Project
