Approved content
The content below is provided by a partner.
powered by micro:bit
The package adds support PTKidsBIT board from PT-BOT.
P0
– Connected to BuzzerP1
– Digital Input/Output and Analog Input/OutputP2
– Digital Input/Output and Analog Input/OutputP8
– Connected to RX Pin ESP8266P12
– Connected to TX Pin ESP8266P13
– 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) and PWM chip (PCA9685)P20
– SDA connected to I2C-based 12-bit ADC chip (ADS7828) and PWM chip (PCA9685)Use PTKidsBIT’s MotorWrite block to drives 1 motor forward and backward. The speed motor is adjustable between 0 to 100.
1
or 2
-100
to 100
(Greater than 0 is forward, less than 0 is backward)PTKidsBIT.motorWrite(Motor_Write.Motor_1, 50)
Use PTKidsBIT’s motorGo block to drives 2 motor 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)PTKidsBIT.motorGo(50, -50)
Use PTKidsBIT’s Turn block to control the robot movment by turning. The one motor will stop, another one is moving.
Left
or Right
0
to 100
PTKidsBIT.Turn(_Turn.Left, 50)
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.
Left
or Right
0
to 100
PTKidsBIT.Spin(_Spin.Left, 50)
Use PTKidsBIT’s Motor Stop block is used to stop both motors.
PTKidsBIT.motorStop()
Use PTKidsBIT’s servoWrite block for control the servo’s moving degree from 0 to 180
P8
or P12
0 - 180
Released
or Lock
PTKidsBIT.servoWrite(Servo_Write.P8, 180)
Use PTKidsBIT’s WaitClick block for Wait for the command from the button.
Pin
for connecting to the button.Pressed
or Released
.PTKidsBIT.waitClick(Button_Pin.P1, Button_Status.Pressed)
Use PTKidsBIT’s ADCRead block for read analog 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(PTKidsBIT.ADCRead(ADC_Read.ADC0))
})
Use PTKidsBIT’s SensorCalibrate block for calibration line follower sensor, left sensor and right sensor.
0
to 7
for calibrate sensor.The calibration process is as follows
PTKidsBIT.SensorCalibrate([1, 0, 7, 6])
Use PTKidsBIT’s LINESensorSET block for select the ADC channel connected to the sensor.
0
to 7
for line follower sensor.0
to 7
for sensor left.0
to 7
for sensor right.Pin
or Disable
must be selected for the sensor on or off.PTKidsBIT.LINESensorSET(
[1, 0, 7, 6],
[2],
[5],
LED_Pin.Disable
)
Use PTKidsBIT’s ForwardLINE blog for the robot to follow the line forward. When the specified line is found, the robot will stop.
Forward
or Backward
.Left
, Center
or Right
0
to 100
0
to 100
PTKidsBIT.ForwardLINE(
Forward_Direction.Forward,
Find_Line.Left,
30,
60,
0,
0.05,
0.1
)
Use PTKidsBIT’s ForwardTIME blog for the robot to follow the line forward. When the time, the robot will stop.
Forward
or Backward
.0
to 100
0
to 100
PTKidsBIT.ForwardTIME(
Forward_Direction.Forward,
200,
60,
100,
0.03,
0.1
)
Use PTKidsBIT’s TurnLINE block for the Robot to turn until it detects a line.
Left
or Right
0
to 100
PTKidsBIT.TurnLINE(
Turn_Line.Left,
60,
2,
200,
0
)
MIT
PTKidsBIT=github:iBuilds/pxt-ptkidsbit
PTKidsBIT-IoT=github:iBuilds/pxt-PTKidsBIT-IoT#v2.1.4