gpiozero.tools
GPIO Zero includes several utility routines which are intended to be used with the ~gpiozero.SourceMixin.source
and ~gpiozero.ValuesMixin.values
attributes common to most devices in the library. These utility routines are in the tools
module of GPIO Zero and are typically imported as follows:
from gpiozero.tools import scaled, negated, all_values
Given that ~gpiozero.SourceMixin.source
and ~gpiozero.ValuesMixin.values
deal with infinite iterators, another excellent source of utilities is the itertools
module in the standard library.
Warning
While the devices API is now considered stable and won't change in backwards incompatible ways, the tools API is not yet considered stable. It is potentially subject to change in future versions. We welcome any comments from testers!
absoluted
booleanized
clamped
inverted
negated
post_delayed
post_periodic_filtered
pre_delayed
pre_periodic_filtered
quantized
queued
smoothed
scaled
all_values
any_values
averaged
multiplied
summed
cos_values
random_values
sin_values