View on GitHub

pxt-PTKidsBIT-Robot

Makecode extensions for PTKidsBIT: Education Robot kit

PTKidsBIT Robot block package for PT-BOT KidsBIT Robot kit

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.

PTKidsBIT

Line Follower Robot

Line Follower Robot

micro:bit Pin Assignment

Blocks preview

motorWrite Block

Use PTKidsBITRobot’s MotorWrite block to drives 1 motor forward and backward. The speed motor is adjustable between 0 to 100.

PTKidsBITRobot.motorWrite(Motor_Write.Motor_Left, 50)

motorGo Block

Use PTKidsBITRobot’s motorGo block to drive 2 motors forward and backward. The speed motor is adjustable between 0 to 100.

PTKidsBITRobot.motorGo(50, -50)

Turn Block

Use PTKidsBITRobot’s Turn block to control the robot movement by turning. One motor will stop and the other one will be moving.

PTKidsBITRobot.Turn(_Turn.Left, 50)

Spin Block

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.

PTKidsBITRobot.Spin(_Spin.Left, 50)

Motor Stop Block

PTKidsBITRobot’s Motor Stop block is used to stop both motors.

PTKidsBITRobot.motorStop()

servoWrite Block

Use PTKidsBITRobot’s servoWrite block for controling the servo’s moving degree from 0 to 180

PTKidsBITRobot.servoWrite(Servo_Write.P8, 180)

ADCRead Block

Use PTKidsBITRobot’s ADCRead block for reading the analog value from ADC channels. The resolution is 0 to 4095. PTKidsBIT have 8 channel ADC.

basic.forever(function () {
    basic.showNumber(PTKidsBITRobot.ADCRead(ADC_Read.ADC0))
})

SensorCalibrate Block

Use PTKidsBITRobot’s SensorCalibrate block for calibrating the line follower sensor, left sensor and right sensor.

The calibration process is as follows

PTKidsBITRobot.SensorCalibrate()

ForwardLINE Block

Use PTKidsBITRobot’s ForwardLINE blog for the robot to follow the line forward. When the specified line is found, the robot will stop.

PTKidsBITRobot.ForwardLINE(
    Find_Line.Left,
    30,
    60,
    0.05,
    0.1
)

ForwardTIME Block

Use PTKidsBITRobot’s ForwardTIME blog for the robot to follow the line forward. When the time is reached, the robot will stop.

PTKidsBITRobot.ForwardTIME(
    200,
    60,
    100,
    0.03,
    0.1
)

TurnLINE Block

Use PTKidsBITRobot’s TurnLINE block for the Robot to turn until it detects a line.

PTKidsBITRobot.TurnLINE(
    Turn_Line.Left,
    60,
    Turn_Sensor.Center,
    200
)

Supported targets

License

MIT

PTKidsBITRobot=github:iBuilds/pxt-ptkidsbit-robot