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
7
votes
2 answers

Using `gpiozero` on `raspberry pi` to control pins, but output pins are reset upon script exit, even though state is remembered between runs

I am using gpiozero to control devices on the Raspberry Pi. When I create a reference to (for example) an LED device, there is a parameter for creating the object without effecting it's current state: initial_state=None. (The default is…
RufusVS
  • 4,008
  • 3
  • 29
  • 40
6
votes
0 answers

How to troubleshoot GPIO Zero?

I'm trying to do a pretty basic 'get an LED' to blink tutorial with a Raspberry Pi Zero. Following this guide: Blink: Making An LED Blink On A Raspberry Pi I'm able to get the LED to turn on and off with the gpio command line utility, and the…
Lorin
  • 1,022
  • 1
  • 8
  • 14
4
votes
1 answer

Updates can only be scheduled from GUI thread or from QQuickItem::updatePaintNode()

I'm trying to change Image with Pushbutton (GPIO PINs) stored inside a folder using QML with PyQt5 Python Code: from gpiozero import Button from signal import pause from PyQt5.QtCore import * from PyQt5.QtGui import * from PyQt5.QtQml import…
Shivakumar
  • 65
  • 4
3
votes
1 answer

how create executable file that contains gpiozero?

i wrote a script like this for GPIO pins in raspberrypi from gpiozero import LED led = LED(12) and Runs correctly. but when create executable file using pyinstaller, and execute file. i have this error: /tmp/_MEIFanWCr/gpiozero/devices.py:279:…
Sajjad Aemmi
  • 2,120
  • 3
  • 13
  • 25
2
votes
0 answers

Integrate/Connect object detection (webcam) with GPIO on Raspberry Pi 4

I'm trying an object detection program using Python language, and want to connect it to the Raspberry Pi's GPIO. for code in decode(frame): decoded_data = code.data.decode("utf-8") rect_pts = code.rect print("\nID:",…
2
votes
0 answers

Asyncio wrapper around gpiozero Button.wait_for_press() crashes with segmentation fault

I am trying to create an asyncio wrapper around gpiozero's Button.wait_for_press method. This works most of the time but gives Segmentation fault randomly. import asyncio from gpiozero import Button def get_gd_input(): …
2
votes
4 answers

gpiozero.exc.PinPWMUnsupported: PWM is not supported on pin GPIO7 (Raspberry Pi 4B)

I am working on my first Raspberry Pi project while following a course for creating a line-following robot. This is the course. I followed all the instructions and connected the pins as it describes but when I run the code on the Raspberry Pi OS it…
2
votes
2 answers

Simulate "button pressed" an rise an event in gpiozero

I try to develop some code on a machine without GPIO. As GPIO library I selected a gpiozero to be able to write my code without access to gpio of raspberry pi. My problem, I cant get ride of .when_pressed event in the code. I simulate state change…
Diddlik
  • 76
  • 1
  • 9
1
vote
1 answer

If I run on Raspberry Pi some Python commands from the shell they are executed, but not from scripts

I'm trying to control a robot via a Raspberry Pi, using Python language. If I run the commands from the shell they work fine. If I call them from a *.py script the robot doesn't move. If in the script I put the command print('hello') the word…
Leonardo
  • 51
  • 6
1
vote
0 answers

Pi Zero 2 with e-Paper display - error when trying to make the display sleep

I'm in the process of making a little stock tracker using a Pi Zero 2 and an e-Paper display. At the moment I've just got 1 button that when pressed cycles to the next stock, then also updates the display with that stocks information. This all…
1
vote
0 answers

Python using subprocess to open and close a script in a while loop

I am trying to use this script with my raspi to open another script when a button is released, and close the opened script when the button is pressed. If i hold the button i get a constant feed of "camera is not on" which is good thats what i want…
Sam
  • 11
  • 1
1
vote
2 answers

Can you bind two functions to button.when_pressed in python gpiozero?

I am trying to bind two functions to a button, so for example I want to toggle a buzzer and LED with a single button. Is there a way to attach two functions to the same button or can a button only do a single thing at once? For…
1
vote
2 answers

How to stop repeat on button press/hold - Python

I was hoping someone might have some insight on how to stop a script from continuing to repeat if a button is held (or in my case pressed longer than a second)? Basically i've a button setup on the breadboard, and I have it coded to play an audio…
NormanD
  • 11
  • 1
1
vote
0 answers

gpiozero generating io.TextIOWrapper 'noise' when getting load_average

I'm trying to use gpiozero LoadAverage to get the average system load for display on a small OLED plate. The problem is, any time I try to assign LoadAverage().load_average to a variable, it generates a <_io.TextIOWrapper name='/proc/loadavg'…
Scott
  • 7,983
  • 2
  • 26
  • 41
1
vote
0 answers

Python Curses Displaying an Integer

First time posting. I'm a novice writing a python program. I'd like to to curses to display outputs from sensors connected to a Raspberry PI and created the follow code as a test to understand what way it would need to be coded, however i can't get…
Foiloutboy
  • 11
  • 1
1
2 3 4 5 6