Skip to content

Commit 591862b

Browse files
committed
examples: add slider switch to blink all, cause it is so bright
Signed-off-by: Ron Evans <[email protected]>
1 parent 9e1522c commit 591862b

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

examples/blink-all/main.go

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,19 @@ func main() {
1111
visor := gopherbot.Visor()
1212
backpack := gopherbot.Backpack()
1313

14+
slider := gopherbot.Slider()
15+
1416
for {
15-
antenna.On()
16-
visor.Blue()
17-
backpack.Blue()
18-
time.Sleep(500 * time.Millisecond)
17+
if slider.IsOn() {
18+
antenna.On()
19+
visor.Blue()
20+
backpack.Blue()
21+
time.Sleep(500 * time.Millisecond)
1922

20-
antenna.Off()
21-
visor.Clear()
22-
backpack.Clear()
23-
time.Sleep(500 * time.Millisecond)
23+
antenna.Off()
24+
visor.Clear()
25+
backpack.Clear()
26+
time.Sleep(500 * time.Millisecond)
27+
}
2428
}
2529
}

0 commit comments

Comments
 (0)