-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtest.ts
79 lines (76 loc) · 3.3 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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
// xiamiBoard.IR_callbackUser(function (message) {
// if (message == 9) {
// xiamiBoard.setRelay(RELAY.CLOSE)
// } else if (message == 13) {
// xiamiBoard.setRelay(RELAY.DISCON)
// }
// })
// xiamiBoard.initXiaMiBoard()
// xiamiBoard.setIndexColor(xiamiBoard.ledRange(1, 2), 0xff0000)
// xiamiBoard.OLEDshowUserText("M1CW", 0, 0)
// xiamiBoard.motorRun(MOTOR.M1, DIRECTION.CW, 255)
// basic.pause(2000)
// xiamiBoard.OLEDshowUserText("M1CCW", 0, 5)
// xiamiBoard.motorRun(MOTOR.M1, DIRECTION.CCW, 255)
// basic.pause(2000)
// xiamiBoard.OLEDshowUserText("Stop1", 0, 11)
// xiamiBoard.motorStop(MOTOR.M1)
// basic.pause(2000)
// xiamiBoard.setIndexColor(xiamiBoard.ledRange(1, 2), 0xff8000)
// xiamiBoard.OLEDshowUserText("M2CW", 1, 0)
// xiamiBoard.motorRun(MOTOR.M2, DIRECTION.CW, 255)
// basic.pause(2000)
// xiamiBoard.OLEDshowUserText("M2CCW", 1, 5)
// xiamiBoard.motorRun(MOTOR.M2, DIRECTION.CCW, 255)
// basic.pause(2000)
// xiamiBoard.OLEDshowUserText("Stop2", 1, 11)
// xiamiBoard.motorStop(MOTOR.M2)
// basic.pause(2000)
// xiamiBoard.setIndexColor(xiamiBoard.ledRange(1, 2), 0xb09eff)
// xiamiBoard.OLEDshowUserText("M3CW", 2, 0)
// xiamiBoard.motorRun(MOTOR.M3, DIRECTION.CW, 255)
// basic.pause(2000)
// xiamiBoard.OLEDshowUserText("M3CCW", 2, 5)
// xiamiBoard.motorRun(MOTOR.M3, DIRECTION.CCW, 255)
// basic.pause(2000)
// xiamiBoard.OLEDshowUserText("Stop3", 2, 11)
// xiamiBoard.motorStop(MOTOR.M3)
// basic.pause(2000)
// xiamiBoard.setIndexColor(xiamiBoard.ledRange(1, 2), 0x00ffff)
// xiamiBoard.OLEDshowUserText("M4CW", 3, 0)
// xiamiBoard.motorRun(MOTOR.M4, DIRECTION.CW, 255)
// basic.pause(2000)
// xiamiBoard.OLEDshowUserText("M4CCW", 3, 5)
// xiamiBoard.motorRun(MOTOR.M4, DIRECTION.CCW, 255)
// basic.pause(2000)
// xiamiBoard.OLEDshowUserText("Stop4", 3, 11)
// xiamiBoard.motorStop(MOTOR.M4)
// basic.pause(2000)
// xiamiBoard.setIndexColor(xiamiBoard.ledRange(1, 2), 0xff0080)
// basic.forever(function () {
// xiamiBoard.motorRun(MOTOR.M1, DIRECTION.CW, 50)
// basic.pause(1000)
// xiamiBoard.motorRun(MOTOR.M1, DIRECTION.CCW, 50)
// basic.pause(1000)
// })
// basic.forever(function () {
// //xiamiBoard.clear(4, 3, 6)
// xiamiBoard.OLEDshowUserText("AE:" + xiamiBoard.readAngle(), 4, 0)
// //xiamiBoard.clear(5, 3, 6)
// xiamiBoard.OLEDshowUserText("FE:" + xiamiBoard.readFlre(), 5, 0)
// //xiamiBoard.clear(6, 14, 16)
// xiamiBoard.OLEDshowUserText("IR:" + xiamiBoard.IR_read(), 6, 11)
// //xiamiBoard.clear(6, 3, 4)
// //xiamiBoard.OLEDshowUserText("MD:" + xiamiBoard.motorState(MOTOR1.M1, STATE.DIR), 6, 0)
// //xiamiBoard.clear(6, 8, 11)
// //xiamiBoard.OLEDshowUserText("MS:" + xiamiBoard.motorState(MOTOR1.M1, STATE.SPEED), 6, 5)
// //xiamiBoard.clear(7, 5, 8)
// xiamiBoard.OLEDshowUserText("TEMP:" + xiamiBoard.readSensor(SENSOR.AHT20, PARA.TEMP), 7, 0)
// //xiamiBoard.clear(7, 12, 16)
// xiamiBoard.OLEDshowUserText("HUM:" + xiamiBoard.readSensor(SENSOR.AHT20, PARA.HUM), 7, 8)
// //xiamiBoard.OLEDshowUserText("R:" + xiamiBoard.LEDState(LED.RD), 5, 7)
// //xiamiBoard.OLEDshowUserText("Y:" + xiamiBoard.LEDState(LED.YW), 5, 10)
// //xiamiBoard.OLEDshowUserText("G:" + xiamiBoard.LEDState(LED.GN), 5, 13)
// //xiamiBoard.clear(4, 10, 16)
// xiamiBoard.OLEDshowUserText("UR:" + xiamiBoard.Ultrasonic(), 4, 8)
// })