-
Notifications
You must be signed in to change notification settings - Fork 14
/
tests.ts
66 lines (52 loc) · 1.55 KB
/
tests.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
{
// Drive 100 ms forward
bitbot.motor(BBMotor.All, 1023);
basic.pause(100);
// Drive 100 ms reverse
bitbot.motor(BBMotor.All, -1023);
basic.pause(100);
// Drive 100 ms forward on left and reverse on right
bitbot.motor(BBMotor.Left, 1023);
bitbot.motor(BBMotor.Right, -1023);
basic.pause(100);
// Buzz for 100 ms
bitbot.buzz(1);
basic.pause(100);
bitbot.buzz(0);
// Read left and right line sensor
basic.showNumber(bitbot.readLine(BBLineSensor.Left));
basic.showNumber(bitbot.readLine(BBLineSensor.Right));
// Read left and right light sensor
basic.showNumber(bitbot.readLight(BBLightSensor.Left));
basic.showNumber(bitbot.readLight(BBLightSensor.Right));
// Read sonar values
basic.showNumber(bitbot.sonar(BBPingUnit.MicroSeconds));
basic.showNumber(bitbot.sonar(BBPingUnit.Centimeters));
basic.showNumber(bitbot.sonar(BBPingUnit.Inches));
// Show all leds
bitbot.neoSetColor(neopixel.colors(NeoPixelColors.Red));
bitbot.neoShow();
// Clear all leds
bitbot.neoClear();
bitbot.neoShow();
// Show led at position 1
bitbot.neoSetPixelColor(0, neopixel.colors(NeoPixelColors.Red));
bitbot.neoShow();
// Show led rainbow
bitbot.neoRainbow();
bitbot.neoShow();
// Show led rainbow and shift
bitbot.neoRainbow();
bitbot.neoShift();
bitbot.neoShow();
// Show led rainbow and rotate
bitbot.neoRainbow();
bitbot.neoRotate();
bitbot.neoShow();
// Set brightness of leds
bitbot.neoBrightness(100);
bitbot.neoShow();
// Use neo() variable
bitbot.neo().clear();
bitbot.neo().show();
}