-
Notifications
You must be signed in to change notification settings - Fork 16
/
test.ts
24 lines (24 loc) · 1.73 KB
/
test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
maqueenPlusV2.I2CInit()
maqueenPlusV2.setBrightness(100)
basic.forever(function () {
serial.writeLine("Turn on the left light, motor forward, RGB light red")
maqueenPlusV2.setIndexColor(maqueenPlusV2.ledRange(1, 4), maqueenPlusV2.NeoPixelColors.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.setIndexColor(maqueenPlusV2.ledRange(1, 4), maqueenPlusV2.NeoPixelColors.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)
maqueenPlusV2.setIndexColor(maqueenPlusV2.ledRange(1, 4), maqueenPlusV2.NeoPixelColors.Green)
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))
})