-
Notifications
You must be signed in to change notification settings - Fork 0
/
typetest.ts
72 lines (62 loc) · 1.59 KB
/
typetest.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
//% weight=70 icon="\u30A2" color=#EC7505 block="TT"
namespace tt {
//% blockId=tt_test
//% block="Test"
//% shim=tt::test
export function test(): void {
basic.showString("sim-tt-test")
return
}
/**
* prints a string
* @param text text to display, eg: "Hi, CPP!"
*/
//% weight=92 blockGap=8
//% block="Show|string %text"
//% blockId=tt_show
//% shim=tt::show
export function show(text: string): void {
console.log("sim:" + text)
basic.showString("sim:" + text)
return
}
/**
* log a number.
* @param num number to display, eg: 1.5
*/
//% weight=92 blockGap=8
//% block="Log Number|number %num"
//% blockId=tt_lognum
//% shim=tt::lognum
export function lognum(num: number): void {
console.log("sim:")
return
}
//% blockId=tt_gettime
//% block="Current Time"
//% shim=tt::gettime
export function gettime(): string {
return "sim:12:00:00"
}
//% blockId=tt_sumvec
//% block="Sum Vec|number[] %vec"
//% shim=tt::sumvec
export function sumvec(vec: number[]): number {
console.log("sim:" + vec[0])
return vec[0]
}
//% blockId=tt_addvec
//% block="Add Vec|number[] %vec1|number[] %vec2"
//% shim=tt::addvec
export function addvec(vec1: number[], vec2: number[]): number[] {
console.log("sim:" + (vec1[0]+vec2[0]))
return vec1
}
//% blockId=tt_logvec
//% block="Log Vec|number[] %vec"
//% shim=tt::logvec
export function logvec(vec: number[]): void {
console.log("sim:logvec")
return
}
}