This repository has been archived by the owner on Nov 16, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
/
tests.ts
66 lines (63 loc) · 1.69 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
let fi = 0;
let file = "";
input.onButtonPressed(Button.B, () => {
file = "data" + (fi++) + ".csv";
serial.writeLine(file);
files.remove(file)
files.readToSerial(file);
serial.writeLine("");
basic.showString("o")
for (let i = 0; i < 200; ++i) {
let t = input.runningTime();
let ay = input.acceleration(Dimension.Y);
files.appendNumber(file, i);
files.appendString(file, " ");
files.appendNumber(file, i * i);
files.appendLine(file, "");
serial.writeLine(".")
basic.pause(10)
}
serial.writeLine("");
files.readToSerial(file);
basic.showString(":)")
})
let test = Math.randomRange(0, 1000);
files.settingsSaveNumber("test", test);
serial.writeValue("test", test);
let serTest = files.settingsReadNumber("test");
serial.writeValue("serTest", serTest);
control.assert(test == serTest);
let f = files.open("output.txt");
f.writeString("writeString\r\n");
f.seek(0, FileSystemSeekFlags.End);
f.flush();
f.close();
input.onButtonPressed(Button.A, () => {
files.appendLine(
"output.txt",
"hello"
)
})
input.onButtonPressed(Button.B, () => {
basic.showString("H")
files.readToSerial("output.txt")
serial.writeString("Hi")
})
const fn = "out2.txt";
input.onButtonPressed(Button.A, () => {
basic.showString("o")
files.appendLine(fn, "hello");
serial.writeString("[")
files.readToSerial(fn)
})
const fo = "output.txt";
input.onButtonPressed(Button.A, () => {
files.appendLine(fo, "hello")
serial.writeString("W")
basic.showString("W")
})
input.onButtonPressed(Button.B, () => {
files.readToSerial(fo)
serial.writeString("Hi")
basic.showString("H")
})