Approved content
The content below is provided by a partner.
powered by micro:bit
The PTKidsBIT robot from PT-BOT supports the micro:bit microcontroller. PTKidsBIT is equipped with a line following sensor and ultrasonic sensor. It is suitable for learning the basics of robotic programming, such as making a line follower robot and controling a robot via smartphone.
P0
– Connected to BuzzerP1
– Digital Input/Output and Analog Input/OutputP2
– Digital Input/Output and Analog Input/OutputP8
– Digital Input/Output, Analog Input/Output and Servo1P12
– Digital Input/Output, Analog Input/Output and Servo2P13
– DigitalWrite Pin for DC motor control direction 1P14
– AnalogWrite Pin for DC motor speed control 1P15
– DigitalWrite Pin for DC motor control direction 2P16
– AnalogWrite Pin for DC motor speed control 2P19
– SCL connected to I2C-based 12-bit ADC chip (ADS7828)P20
– SDA connected to I2C-based 12-bit ADC chip (ADS7828)Use PTKidsBITRobot’s MotorWrite block to drives 1 motor forward and backward. The speed motor is adjustable between 0 to 100.
Left
or Right
-100
to 100
(Greater than 0 is forward, less than 0 is backward)PTKidsBITRobot.motorWrite(Motor_Write.Motor_Left, 50)
Use PTKidsBITRobot’s motorGo block to drive 2 motors forward and backward. The speed motor is adjustable between 0 to 100.
-100
to 100
(Greater than 0 is forward, less than 0 is backward)-100
to 100
(Greater than 0 is forward, less than 0 is backward)PTKidsBITRobot.motorGo(50, -50)
Use PTKidsBITRobot’s Turn block to control the robot movement by turning. One motor will stop and the other one will be moving.
Left
or Right
0
to 100
PTKidsBITRobot.Turn(_Turn.Left, 50)
Use PTKidsBITRobot’s Spin block to control both motors separately. For example, choose one motor to spin with forward direction another one to spin with backward direction.
Left
or Right
0
to 100
PTKidsBITRobot.Spin(_Spin.Left, 50)
PTKidsBITRobot’s Motor Stop block is used to stop both motors.
PTKidsBITRobot.motorStop()
Use PTKidsBITRobot’s servoWrite block for controling the servo’s moving degree from 0 to 180
P8
or P12
0 - 180
PTKidsBITRobot.servoWrite(Servo_Write.P8, 180)
Use PTKidsBITRobot’s ADCRead block for reading the analog value from ADC channels. The resolution is 0 to 4095. PTKidsBIT have 8 channel ADC.
Pin
from 0
to 7
for reading the analog sensor.basic.forever(function () {
basic.showNumber(PTKidsBITRobot.ADCRead(ADC_Read.ADC0))
})
Use PTKidsBITRobot’s SensorCalibrate block for calibrating the line follower sensor, left sensor and right sensor.
The calibration process is as follows
PTKidsBITRobot.SensorCalibrate()
Use PTKidsBITRobot’s ForwardLINE blog for the robot to follow the line forward. When the specified line is found, the robot will stop.
Left
, Center
or Right
0
to 100
0
to 100
PTKidsBITRobot.ForwardLINE(
Find_Line.Left,
30,
60,
0.05,
0.1
)
Use PTKidsBITRobot’s ForwardTIME blog for the robot to follow the line forward. When the time is reached, the robot will stop.
0
to 100
0
to 100
PTKidsBITRobot.ForwardTIME(
200,
60,
100,
0.03,
0.1
)
Use PTKidsBITRobot’s TurnLINE block for the Robot to turn until it detects a line.
Left
or Right
0
to 100
PTKidsBITRobot.TurnLINE(
Turn_Line.Left,
60,
Turn_Sensor.Center,
200
)
MIT
PTKidsBITRobot=github:iBuilds/pxt-ptkidsbit-robot
PTKidsBIT-Robot=github:iBuilds/pxt-PTKidsBIT-Robot#v1.6.4