Questions tagged [gpiozero]

This tag should be used for questions relating to Gpiozero, an open-source interface library to control GPIO devices on a Raspberry Pi.

General Purpose Input/Ouput (GPIO) devices on a Raspberry Pi can be controlled using Gpiozero.

More details can be found in the Gpiozero documentation and the main GitHub repository for the project.

83 questions
0
votes
1 answer

What is wrong with my python 2 code that incorporates a wii remote that activates a buzzer via GPIO on a raspberry pi zero w?

Here is my python code that I am using. I am trying to use a wii remote to trigger a buzzer. I thought this would be an interesting use for my old wii remote. The code that interacts with the buzzer works fine because I used an example script to…
0
votes
0 answers

Raspberry pi expansion I2C PCF8574 used remotely like remote GPIO

I would use remotely a I2C expansion (IO PCF8574) connected to a RPI 192.168.0.10 from a different RPI 192.168.0.11 like the remote GPIO. I followed the instructions from http://abyz.me.uk/rpi/pigpio/index.html but I'm a newbie and I can't see…
0
votes
0 answers

gpio zero button press error with aiy pins.py

With a button connected to GND and PIN_D on a V2 AIY Voice Bonnet and code: from gpiozero import Button from signal import pause from aiy.pins import PIN_D button = Button(PIN_D) button.wait_for_press() print("The button was pressed.") pause() I…
0
votes
2 answers

Running gpiozero listener continuously with uvicorn

I am trying to write a python app that will run on raspberry pi, that will have both socket connection (socketio with uvicorn) and physical input listeners. I intend to listen for socket connection and gpio events concurrently, without blocking each…
0
votes
0 answers

GPIOZERO Measure time of inactive/active state of digital input

I have a dust sensor, and I have to measure a sum of inactive time in 30 seconds cycles. For DigitalInputDevice gpiozero provides cool functionality, I mean two properties, and two callbacks: properties - active_time (return float if pin is active…
0
votes
1 answer

GPIO Zero: MotionSensor.value not updating live

When running the following simple code, I would expect the [while True] to return an endless stream of 1 and 0, relating to the pir motion sensor state. However, once triggered, I only get 1s, even once motion has ended. If I do the opposite (ie,…
0
votes
2 answers

How do I flash an LED and change the fill color of a shape at the same time?

I am writing code for a live car turn signal. I can make an LED flash, and I can make a polygon change its fill color to simulate a turn signal. This worked for the led: def blink_arrow(): leftBlinker.blink(on_time=.7, off_time=.3, n=3) and…
KenS
  • 31
  • 4
0
votes
2 answers

Return value of reference function in button.when_pressed

I'm trying to have the return value of a function stored in a variable. The function is called (by a reference) when a Raspberry Pi gpiozero button is pressed. from gpiozero import Button from signal import pause def fcn(a): print(a) b = a…
arjobsen
  • 313
  • 2
  • 12
0
votes
1 answer

Continue running a loop until a button is pressed using gpiozero - button press not registered

I have some python code on a raspberry pi that I want to run and carry on a loop until a button is pressed. The button.wait_for_press() is not suitable because that pauses the program until it runs, but I have tried it out to see if the hardware is…
James
  • 13
  • 1
  • 5
0
votes
1 answer

GPIOZero Pi Alarm system: Need alternative for time delay

I require help with my alarm system code that I am building with GPIOZero library (my boss really likes the library). The system is meant for a laptop cart so people do not forget to close the door as there is a buzzer that rings if people leave it…
Draenokh
  • 79
  • 1
  • 8
0
votes
0 answers

Why does my gpio button work when connected in hdmi but if not it automatically triggers the button in raspberry pi?

I am still new in python and I am wondering when I switch from a desktop monitor to a 3.5 TFT LCD monitor and I tried to use a button if the hdmi is connected the gpio button works but if i remove it it automatically triggers the button without me…
James Wu
  • 27
  • 4
0
votes
1 answer

Stepper Motor with Raspberry Pi only works with some delay times with GPIOZero

I am experimenting with connecting Stepper Motor 28BYJ-48 with ULN2003 Driver board to Raspberry Pi Model 3 B using Python and GPIOZero. I hacked together some code that works, using a few different examples I found, and I can now get the motor to…
Glenn
  • 175
  • 2
  • 15
0
votes
0 answers

Openhab2 exec binding to external rpi using pigpio and gpiozero

Using openhab2 on machine A. Machine B is a RPi which controls a relay. Using pigpio and gpiozero from machine a to control machine b gpio pins. Using below script for testing. How can I rewrite this so that the on/off function in openhab will work?…
user6838225
0
votes
1 answer

Python - Raspberry pi GPIO to SQlite3 - High/Lov with timestamp

Right now i have a simple python solution that's working perfect. it is making a log.txt file and update everytime there is a connection on/off GPIO 12. But the file is getting longer and longer, and it's time to upgrade to a little database…
0
votes
1 answer

how to get state of raspberry pi pins?

I need to write two program for raspberry pi 3. In program 1 I define some pins as output and set a value on it then I want to get state(value) of those pins in program 2 in another word I want to set a value to pins in a process and read the values…