Approved content

The content below is provided by a partner.

iBuilds/pxt-PTKidsBIT-IoT 2.1.4 GitHub

PTKidsBIT block package for PT-BOT KidsBIT: IoT

powered by micro:bit

PTKidsBIT

The package adds support PTKidsBIT board from PT-BOT.

micro:bit Pin Assignment

Blocks preview

motorWrite Block

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

PTKidsBIT.motorWrite(Motor_Write.Motor_1, 50)

motorGo Block

Use PTKidsBIT’s motorGo block to drives 2 motor forward and backward. The speed motor is adjustable between 0 to 100.

PTKidsBIT.motorGo(50, -50)

Turn Block

Use PTKidsBIT’s Turn block to control the robot movment by turning. The one motor will stop, another one is moving.

PTKidsBIT.Turn(_Turn.Left, 50)

Spin Block

Use PTKidsBIT’s Spin block to control both motors separately. For example, choose one motor spin with forward direction another one spin with backward direction.

PTKidsBIT.Spin(_Spin.Left, 50)

Motor Stop Block

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

PTKidsBIT.motorStop()

servoWrite Block

Use PTKidsBIT’s servoWrite block for control the servo’s moving degree from 0 to 180

PTKidsBIT.servoWrite(Servo_Write.P8, 180)

WaitClick Block

Use PTKidsBIT’s WaitClick block for Wait for the command from the button.

PTKidsBIT.waitClick(Button_Pin.P1, Button_Status.Pressed)

ADCRead Block

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

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

SensorCalibrate Block

Use PTKidsBIT’s SensorCalibrate block for calibration line follower sensor, left sensor and right sensor.

The calibration process is as follows

PTKidsBIT.SensorCalibrate([1, 0, 7, 6])

LINESensorSET Block

Use PTKidsBIT’s LINESensorSET block for select the ADC channel connected to the sensor.

PTKidsBIT.LINESensorSET(
    [1, 0, 7, 6],
    [2],
    [5],
    LED_Pin.Disable
)

ForwardLINE Block

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

PTKidsBIT.ForwardLINE(
    Forward_Direction.Forward,
    Find_Line.Left,
    30,
    60,
    0,
    0.05,
    0.1
)

ForwardTIME Block

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

PTKidsBIT.ForwardTIME(
    Forward_Direction.Forward,
    200,
    60,
    100,
    0.03,
    0.1
)

TurnLINE Block

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

PTKidsBIT.TurnLINE(
    Turn_Line.Left,
    60,
    2,
    200,
    0
)

Supported targets

License

MIT

PTKidsBIT=github:iBuilds/pxt-ptkidsbit
PTKidsBIT-IoT=github:iBuilds/pxt-PTKidsBIT-IoT#v2.1.4