-
Notifications
You must be signed in to change notification settings - Fork 32
/
blink2leds.thingml
56 lines (47 loc) · 1.07 KB
/
blink2leds.thingml
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
import "../hardware/bricks/led.thingml"
thing Blink2Leds includes LedMsgs, TimerMsgs
{
property freq : Integer[2]
set freq[0] = 1000
set freq[1] = 333
required port timer1
{
sends timer_start
receives timer_timeout
}
required port timer2
{
sends timer_start
receives timer_timeout
}
required port led1
{
sends led_toggle
}
required port led2
{
sends led_toggle
}
statechart Blink2LedsImpl init Blinking
{
state Blinking
{
on entry do
//crap
var tab : Integer[8]
timer1!timer_start(freq[0])
timer2!timer_start(freq[1])
end
internal Blink1 event timer1?timer_timeout
action do
led1!led_toggle()
timer1!timer_start(freq[0])
end
internal Blink2 event timer2?timer_timeout
action do
led2!led_toggle()
timer2!timer_start(freq[1])
end
}
}
}