Skip to content

Latest commit

 

History

History
77 lines (46 loc) · 1.66 KB

api_tools.rst

File metadata and controls

77 lines (46 loc) · 1.66 KB

Source Tools

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!

Single source conversions

absoluted

booleanized

clamped

inverted

negated

post_delayed

post_periodic_filtered

pre_delayed

pre_periodic_filtered

quantized

queued

smoothed

scaled

Combining sources

all_values

any_values

averaged

multiplied

summed

Artificial sources

cos_values

random_values

sin_values