This repository has been archived by the owner on Jun 27, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 108
/
foosball.fbp
executable file
·51 lines (41 loc) · 1.76 KB
/
foosball.fbp
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
#!/usr/bin/env sol-fbp-runner
# This file is part of the Soletta (TM) Project
#
# Copyright (C) 2015 Intel Corporation. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# This is a fossball table score tracker.
# declare a new flow node type 'Tracker' that is a fbp file tracker.fbp
DECLARE=Tracker:fbp:tracker.fbp
# and create two nodes using this type, each representing a side of the table
red_tracker(Tracker)
yellow_tracker(Tracker)
# we declare a winner on the 5th goal
win_score(constant/int:value=5)
win_score OUT -> WIN_SCORE red_tracker
win_score OUT -> WIN_SCORE yellow_tracker
# if there is a winner, turn on its LED
red_tracker WON -> IN red_won_output(gtk/led:rgb=255|0|0)
yellow_tracker WON -> IN yellow_won_output(gtk/led:rgb=255|255|0)
# and cheer output
red_tracker WON -> IN[0] there_is_a_winner(boolean/or)
yellow_tracker WON -> IN[1] there_is_a_winner
there_is_a_winner OUT -> IN cheer_output(gtk/led)
# only for 3 seconds (3000 ms), then reset automatically
there_is_a_winner OUT -> ENABLED cheer_timeout(timer:interval=3000)
cheer_timeout OUT -> RESET red_tracker
cheer_timeout OUT -> RESET yellow_tracker
# allow premature reset, eventually someone will give up ;-)
reset(gtk/pushbutton)
reset OUT -> RESET red_tracker
reset OUT -> RESET yellow_tracker