Skip to content

Instantly share code, notes, and snippets.

@topshed
Last active January 24, 2019 15:01
Show Gist options
  • Save topshed/5de67281f0998f2977457f7d8190ca28 to your computer and use it in GitHub Desktop.
Save topshed/5de67281f0998f2977457f7d8190ca28 to your computer and use it in GitHub Desktop.
Using gpiozero distance sensor on Pi Zero
from gpiozero.pins.pigpio import PiGPIOFactory
from gpiozero import DistanceSensor
pigpio = PiGPIOFactory()
ds = DistanceSensor(14,15, max_distance=200, pin_factory=pigpio)

or

from gpiozero.pins.pigpio import PiGPIOFactory
from gpiozero import DistanceSensor
ds = DistanceSensor(14,15, max_distance=200, pin_factory=PiGPIOFactory())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment