-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.ts
20 lines (20 loc) · 1.41 KB
/
test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
maqueenPlusV2.I2CInit()
basic.forever(function () {
serial.writeLine("Turn on the left light, motor forward, RGB light red")
maqueenPlusV2.controlMotor(maqueenPlusV2.MyEnumMotor.AllMotor, maqueenPlusV2.MyEnumDir.Forward, 100)
maqueenPlusV2.controlLED(maqueenPlusV2.MyEnumLed.LeftLed, maqueenPlusV2.MyEnumSwitch.Open)
basic.pause(2000)
serial.writeLine("Turn on the right side light, motor back, RGB light yellow")
maqueenPlusV2.controlMotor(maqueenPlusV2.MyEnumMotor.AllMotor, maqueenPlusV2.MyEnumDir.Backward, 100)
maqueenPlusV2.controlLED(maqueenPlusV2.MyEnumLed.LeftLed, maqueenPlusV2.MyEnumSwitch.Close)
maqueenPlusV2.controlLED(maqueenPlusV2.MyEnumLed.RightLed, maqueenPlusV2.MyEnumSwitch.Open)
basic.pause(2000)
serial.writeLine("Turn on the side lights, motor forward, RGB light green")
maqueenPlusV2.controlMotor(maqueenPlusV2.MyEnumMotor.AllMotor, maqueenPlusV2.MyEnumDir.Forward, 100)
maqueenPlusV2.controlLED(maqueenPlusV2.MyEnumLed.AllLed, maqueenPlusV2.MyEnumSwitch.Open)
basic.pause(2000)
serial.writeLine("Printing sensor data")
serial.writeLine("SensorL1 status:" + maqueenPlusV2.readLineSensorState(maqueenPlusV2.MyEnumLineSensor.SensorL1))
serial.writeLine("SensorL1 ADC:" + maqueenPlusV2.readLineSensorData(maqueenPlusV2.MyEnumLineSensor.SensorL1))
serial.writeLine("ultrasonic sensor:" + maqueenPlusV2.readUltrasonic(DigitalPin.P13, DigitalPin.P14))
})