Skip to content

Commit

Permalink
Correct ButtonBoard examples
Browse files Browse the repository at this point in the history
  • Loading branch information
bennuttall committed Jun 28, 2020
1 parent 76261e0 commit 965c21e
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions gpiozero/boards.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,18 +163,21 @@ class ButtonBoard(HoldMixin, CompositeDevice):
leds = LEDBoard(2, 3, 4, 5)
btns = ButtonBoard(6, 7, 8, 9)
leds.source = btns.values
leds.source = btns
pause()
Alternatively you could represent the number of pressed buttons with an
:class:`LEDBarGraph`::
from gpiozero import LEDBarGraph, ButtonBoard
from statistics import mean
from signal import pause
graph = LEDBarGraph(2, 3, 4, 5)
btns = ButtonBoard(6, 7, 8, 9)
graph.source = (sum(value) for value in btn.values)
bb = ButtonBoard(6, 7, 8, 9)
graph.source = (mean(values) for values in bb.values)
pause()
:type pins: int or str
Expand Down

0 comments on commit 965c21e

Please sign in to comment.