Questions tagged [gpiozero]

For questions relating to the python gpiozero library.

Filter by
Sorted by
Tagged with
0
votes
1answer
45 views

RPi.GPIO: multiple buttons one callback function, ignore buttons while callback is executing

I have 4 buttons connected to my Raspberry Pi that call the same function when pressed. I'm using GPIO.add_event_detect to connect the buttons to the callback function. When one button press executes ...
0
votes
1answer
36 views

gpiozero button to raise SystemExit / gpiozero clash with GPIO.cleanup()

TL;DR: Since this is a long question I have the following problems: I'm looking for a good way to use gpiozero Button to raise SystemExit upon button press I have an imported module to drive an E-Ink ...
1
vote
0answers
39 views

Rasberry Pi 4 LED.off() will not turn led off in a function

I have a simple circuit connected to my Raspberry Pi 4 with 3 push buttons and an LED. The buttons are connected to gpio2(pin 3), gpio17(pin 11), and gpio16(pin36), with the LED connected to gpio25(...
-1
votes
1answer
49 views

How to know if a pin is assined in raspberry pi?

I'm "playing" with Django and I'm trying to read the state of a pin when a button is pressed using gpiozero. I'm able to do this without trouble outside Django, meaning that I can detect ...
9
votes
5answers
21k views

Failed to create MMAL component b'vc.ril.camera': Out of memory

I am trying to run a simple script that listens for a button click and then takes a picture. Once two pictures have been taken it compares the two using OpenCV to calculate the difference. I am ...
5
votes
1answer
1k views

How fast can GPIO pins toggle on the Pi 4?

Benchmarking of the Pi 4 using the Python GPIO Zero library shows a significant increase in the frequency of toggling a GPIO pin on and off compared to previous models. This result is attributed to ...
0
votes
0answers
24 views

Robot Function Queue

I'm trying to build a restful microservice that controls my robot. Basically, someone(or an app) can hit a URL and move my robot. This is just for fun on my local network. So far, it works well enough ...
-1
votes
2answers
55 views

LEDs not turning off after Raspberry Pi power down

I have a Raspberry Pi with six LEDs and button (also with LED) on the custom circuit board that is connected to GPIO pins. This RPi previously had an AdaFruit Neopixel with LEDs, but later my client ...
0
votes
1answer
433 views

Wiring Omron D6T Thermal Sensor to Raspberry Pi Zero W with Adafruit T-Cobbler Plus

I have a Raspberry Pi Zero W connected to a Adafruit T-Cobbler Plus and breadboard. My question is regarding wiring. I have followed tutorials to create simple circuits, however, I am struggling to ...
0
votes
1answer
2k views

How to toggle button on and off with gpiozero?

I can't seem to find a solution of doing this using gpiozero. I've done it using rpi.gpio with add_event_detect and call back to change state but I was under the impression gpiozero is much simpler. ...
0
votes
1answer
40 views

GPIO Soundboard with just one button [closed]

i am trying to program a soundboard in python using gpiozero and a single button. Every time you press the button it should play the next sound. It almost works, but unfortunately not satisfactory yet....
0
votes
2answers
230 views

Using Gpiozero for Relay Device

I am writing a Python app on my RPi to manage an 8-port Sainsmart relay. All that I need to do operate a port on that relay is to change the state on a GPIO pin to either low or high. I cannot find ...
0
votes
1answer
83 views

pi camera will not work with Pi zero

My Pi camera will not work with the Pi zero using the same python code I use on my Pi 3 or Pi 2 Is there something I am missing?
0
votes
1answer
58 views

gpiozero's LED.toggle() switches LED again after some seconds

I am using the gpiozero library to controll a LED strip and a relay connected to my raspberry pi 4. This is the way I connected the LED strip to the pins. I use a type SMD5050 LED strip similar to the ...
0
votes
1answer
25 views

Python tkinder reset button code fails on third attempt

I am trying to trigger a timer when there is audio and stop the timer when the audio is lower than a set value. There is a reset button that will reset the timer back to zero. The reset button works ...
0
votes
1answer
52 views

Register button presses within button press function?

I'm working with code that looks something like this: from time import sleep from gpipozero import Button BUTTONS = { 'start': Button(21), 'choice_1': Button(1), 'choice_2': Button(7), } ...
0
votes
0answers
27 views

Fast/efficient code to wait for trigger, trigger causes camera to collect image stream, process, wait for trigger, wash rinse repeat

I am working on a project to detect trained objects with google coral once I capture images (temporarily, i.e. cache) upon an external trigger. The focus here is the front end trigger and capture ...
0
votes
2answers
85 views

Cannot connect to UART via USB

I am trying to connect to a raspberry pi zero (and a pi3) via uart and USB (USB to TTL YP-01) I am connected to pin 8, pin 10 and a ground. tx -> rx, rx -> tx I have tried everything on this url ...
0
votes
0answers
29 views

Why don't my LEDS stay on when the guizero buttons are pressed?

I wrote a simple python dashboard, using guizero and gpiozero, to turn LEDS on and off. I only have a problem with the LEDS, they only turn on for 1 second before they turn off. I tried to use time....
2
votes
2answers
456 views

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:...
1
vote
2answers
187 views

GPIOZero- How to double button press?

I am new to Python, used my Python common sense but did not get any results. I am trying to learn how to do x-times of button presses and in x-amount of time to trigger something. In the below code, I ...
1
vote
3answers
108 views

How exactly do i make a LED Blink? I tried every possible result

I am trying to make a LED blink on a Raspberry Pi Breadboard, but after everything I've tried, it doesn't work. I have tried: Changing wires and moving them around Switching LED's to check if the ...
0
votes
1answer
81 views

Using gpiozero and RPi.GPIO in one script

I use the gpiozero.MotionSensor to detect motion and upon motion to change the state of GPIO pin 17 using RPi.GPIO. This works well. At the end of the script I clean up using RPi.GPIO.cleanup(), but ...
-1
votes
1answer
506 views

function to wait for any of the buttons press

I'm working on a project that use four buttons to navigate in a menu. The root options of the menu have nested options etc. The buttons don't have hardware de-bouncing. My ultimate objective is to ...
1
vote
2answers
63 views

Breadboard circuit with LED going through 2 circuits doesn't work as expected

I have the resistor, GPIO24, and the LED anode connected along the same row of a breadboard. The signal from GPIO24 works as expected, but any signal from GPIO23 is lost and the LED will not light. I ...
1
vote
1answer
195 views

gpiozero on a pi4?

Working on getting some working samples setup for my son on his RPI4 so he can play with the GPIO's, breadboard, and some various pieces to use with the breadboard. Right now we're trying to test out ...
1
vote
1answer
484 views

High Impedance state for GPIO

I've not used GPIO on RPi much. On other hardware, the GPIO pins can be configured in software to be in a "High Impedance" state (Hi-Z). I have assumed that it's possible to place most of ...
1
vote
1answer
66 views

RGB LED - Only first color activates when multiple colors are called

I have one RGB LED (common anode type), and while I can get every color to light up independently I am seeing some bizarre behavior when trying to combine colors. This is my first project involving ...
0
votes
1answer
80 views

Long/short button press doesn`t work with IF statements - Need some help [closed]

I am trying to build a simple game and I have the following problem. My code is executed but the button presses cannot be detected whatever I am trying. There are no errors and I cannot figure out why ...
0
votes
0answers
105 views

PIR sensor connection to the Raspberry Pi not working

I'd like to connect a PIR sensor (HC-SR501) to the Raspberry Pi, namely GPIO BCM 4. But the pin level always reads as 0. If I assemble a standalone circuit with PIR (its OUT pin - resistor - LED - GND)...
0
votes
1answer
64 views

Show boot info on character LCD

Is it possible to show boot log or info on a character LCD that the Raspberry Pi is still booting? I'm using a generic 16x2 character LCD
2
votes
1answer
925 views

GPIO inputs don't work on Raspberry 4 running Ubuntu

I have several RasPIs set up with Ubuntu Server 18.04 64Bit. One freshly setup up RasPIs 3B+ and two 4Bs. On all I can run the following minimum script without any error messages: #!/usr/bin/env ...
-1
votes
2answers
124 views

Problems with the rpi zero and relay [closed]

I Have a problem... (above the relay-coil Datasheet) I want to control a single relay with my pi zero, but it seems that it doesn't have enough power. the 3.3V pin of the rpi (measured to 3.19V) works ...
1
vote
0answers
93 views

I2C, SPI and Python Libraries with Raspberry Pi 4b

I've been working with RPi.GPIO so far but I have had issues with PWM and edge detection, which are well known issues with RPi.GPIO, anyway, after some research I'm considering using a different ...
0
votes
0answers
74 views

when_pressed and when_released functions in gpiozero not working

I have the following code, and I cannot figure out how to make when_pressed and when_released work. The callback functions just do not run to the press and release. On the other hand, properties such ...
0
votes
1answer
92 views

PWM problem in a frequency less than 100Hz

I have attached a fan to pin #17 (through a transistor of course) and am writing a script to turn the fan on for a specified duration with a specified PWM duty. #!/usr/bin/env python import os ...
0
votes
0answers
32 views

How can I control pins with node js + gpiozero + signal?

I have a project written in python using the gpiozero library controlling some buttons, an LCD, and some LEDs. The file follows the format of setting callback functions, defining event handlers, and ...
2
votes
1answer
151 views

gpiozero for remote gpio control not work

i just knew how to control gpio from my laptop to desire raspberry pi using gpiozero. so, i following this docs on how to configure the raspberry pi and my laptop to performing remote gpio control. i ...
0
votes
1answer
126 views

Increase sleep interval for LED sequence whenever button is pressed. (Python)

This is the code: #!/usr/bin/python3 from time import sleep from gpiozero import LED, Button from threading import Thread from signal import pause, signal, SIGTERM LEDs = [5, 17, 22, 19, 26] LIGHTS ...
-2
votes
3answers
56 views

What is simplest Python code to call the begin_time function with the value of time equal to 5 when the launch Button is pressed?

I have the following code: def begin_time(time): print(time) from gpiozero import Button begin = Button(27) I want to call this function with time = 5 Any help would be appreciated
2
votes
2answers
98 views

Can I use the Python Interpreter to list a modules' classes and methods, as well as descriptions? [closed]

I believe there is documentation available online, but for the sake of learning a little more about the interpreter, I am specifically wondering if I can use it to find out what is all available for ...
0
votes
0answers
40 views

Interrupt Servo once movement has initiated

I'm new to python and RPis. I'm building my own robot to learn. I manage to control my little robot and move it around, as well as moving the pan camera with my keyboard. While I was searching for a ...
1
vote
1answer
1k views

Please set pin numbering mode using GPIO.setmode(GPIO.BOARD) or GPIO.setmode(GPIO.BCM)

I've got an LED on bcm 18 and a servo motor on bcm 8. My code appears here. from gpiozero import LED import RPi.GPIO as GPIO import time GPIO.setmode(GPIO.BCM) GPIO.setup(8,GPIO.OUT) servo = GPIO....
2
votes
1answer
95 views

How do I incorporate a button for pedestrian crossing when making traffic lights?

Here's a link to what I have been trying a accomplish: https://projects.raspberrypi.org/en/projects/physical-computing/9 Near the bottom of the page it says, "Try adding the button for a pedestrian ...
1
vote
1answer
510 views

While loop picking up button press twice with gpiozero

good morning! I've been working on some python (pretty new to the language) to control some buttons and LEDs utilising gpiozero and I've run into a few issues which I've been trying to troubleshoot ...
0
votes
2answers
2k views

function button.is_pressed from gpiozero do not work

Im working on a university project with raspberry and gpiozero. I need to manage the button response to take diferent actions. The problem is that de function button.is_pressed its always true (even ...
1
vote
1answer
541 views

Using GPIO from my virtualenv

I have a project I am developing with python3. I would like to add some status LED functions to it. If I am not root everything is fine, my activated virtualenv is all good, but I cannot use GPIO (...
0
votes
1answer
116 views

How to wire a button

O have tried to do this so many times, so many websites, so many books, and it just won't work. I do not know how to wire it so that the LED lights up when I press the button. I'm pretty sure that I ...
-1
votes
1answer
35 views

How to make lilypad temperature sensor work with raspberry pi zero?

I discovered a lilypad sensor thought of connecting it with raspberry pi zero to measure living room temperature. But lilypad sensor is analog input and pi doesn’t have analog pin. How can i make ...
3
votes
0answers
100 views

Raspberry Pi button bug, what is happening?

I am new user of raspberry pi. I have two buttons, and some code to run, yet the led will not react to the buttons. It's probably a easy fix, but keep in mind, I am new to robotic and have only ...