File tree Expand file tree Collapse file tree 4 files changed +31
-78
lines changed
Expand file tree Collapse file tree 4 files changed +31
-78
lines changed Original file line number Diff line number Diff line change 1+ target C
2+
3+ reactor Sensor {
4+ output out:int
5+ timer t(0, 1s)
6+ state s:int = 0
7+ reaction(t) -> out {=
8+ lf_sleep(MSEC(100));
9+ lf_set(out, self->s++);
10+ =}
11+ }
12+
13+ reactor Processing {
14+ input in:int
15+ output out:int
16+ reaction(in) -> out {=
17+ lf_sleep(MSEC(200));
18+ lf_set(out, in->value * -2);
19+ =}
20+ }
21+
22+ reactor Actuator {
23+ input in:int
24+ reaction(in) {=
25+ lf_sleep(MSEC(300));
26+ printf("Received %d\n", in->value);
27+ =}
28+ }
Original file line number Diff line number Diff line change @@ -16,32 +16,7 @@ target C {
1616 timeout: 5s,
1717}
1818
19- reactor Sensor {
20- output out:int
21- timer t(0, 1s)
22- state s:int = 0
23- reaction(t) -> out {=
24- lf_sleep(MSEC(100));
25- lf_set(out, self->s++);
26- =}
27- }
28-
29- reactor Processing {
30- input in:int
31- output out:int
32- reaction(in) -> out {=
33- lf_sleep(MSEC(200));
34- lf_set(out, in->value * -2);
35- =}
36- }
37-
38- reactor Actuator {
39- input in:int
40- reaction(in) {=
41- lf_sleep(MSEC(300));
42- printf("Received %d\n", in->value);
43- =}
44- }
19+ import Sensor, Processing, Actuator from "./Lib.lf"
4520
4621main reactor {
4722 s = new Sensor()
Original file line number Diff line number Diff line change @@ -13,32 +13,7 @@ target C {
1313 timeout: 5s,
1414}
1515
16- reactor Sensor {
17- output out:int
18- timer t(0, 1s)
19- state s:int = 0
20- reaction(t) -> out {=
21- lf_sleep(MSEC(100));
22- lf_set(out, self->s++);
23- =}
24- }
25-
26- reactor Processing {
27- input in:int
28- output out:int
29- reaction(in) -> out {=
30- lf_sleep(MSEC(200));
31- lf_set(out, in->value * -2);
32- =}
33- }
34-
35- reactor Actuator {
36- input in:int
37- reaction(in) {=
38- lf_sleep(MSEC(300));
39- printf("Received %d\n", in->value);
40- =}
41- }
16+ import Sensor, Processing, Actuator from "./Lib.lf"
4217
4318main reactor {
4419 s = new Sensor()
Original file line number Diff line number Diff line change @@ -14,32 +14,7 @@ target C {
1414 timeout: 5s,
1515}
1616
17- reactor Sensor {
18- output out:int
19- timer t(0, 1s)
20- state s:int = 0
21- reaction(t) -> out {=
22- lf_sleep(MSEC(100));
23- lf_set(out, self->s++);
24- =}
25- }
26-
27- reactor Processing {
28- input in:int
29- output out:int
30- reaction(in) -> out {=
31- lf_sleep(MSEC(200));
32- lf_set(out, in->value * -2);
33- =}
34- }
35-
36- reactor Actuator {
37- input in:int
38- reaction(in) {=
39- lf_sleep(MSEC(300));
40- printf("Received %d\n", in->value);
41- =}
42- }
17+ import Sensor, Processing, Actuator from "./Lib.lf"
4318
4419main reactor {
4520 s = new Sensor()
You can’t perform that action at this time.
0 commit comments