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

Raspberri pi with gpiozero relay hangs on when using while loop

I am using this relay module with Raspi zero. https://www.amazon.co.jp/gp/product/B083LRNXBJ/ref=ppx_yo_dt_b_asin_title_o02_s00?ie=UTF8&psc=1 And I am using gpiozero to control relay. import gpiozero import time RELAY_PIN = 14 relay =…
Jaydeep
  • 446
  • 1
  • 6
  • 17
0
votes
1 answer

How to use gpiozero button methods to check when a button is pressed at a certain time

I am currently working on a small project to get started with physical computing with Python - using a raspberry pi. I am trying to make a game using 3 LED's and a push button. The 3 LED's will flash in a certain order for different times and you…
Ahmed M
  • 21
  • 5
0
votes
1 answer

Raspberry Pi + GPIOzero: press button to change a variable in a loop (while the loop keeps on running)

I'm trying to make a visual metronome of sorts in which I press a button in order to change the bpm. Once the bpm is 85, if the button is pressed once more, if goes back to the default bpm (of 120). t this is my code: from gpiozero import * from…
leonedott
  • 3
  • 3
0
votes
1 answer

Can I break out of a for loop with a function?

I've made a for loop that will do times tables at the press of a button using gpiozero and want to make a long press exit the loop. Initially I thought I could make a function with a break in it that would exit the loop with a long press but as the…
0
votes
1 answer

How to use gpiozero.Button.when_pressed within a class or function

I'm working on a weather station (raspberry pi) and I'm using python. I developed a program that is working, but now I decided to update my code and to structure everything (making classes etc.). But now I have encountered two problems concerning…
JacobSelt
  • 11
  • 1
  • 3
0
votes
2 answers

kivy: "Exception: Shader didnt link" when called by gpiozero callback, but not by kivy.uix.button callback

I am writing a GUI using a camera in kivy, and am unsure why my code is not working. I have a camera feed, and two methods of capturing a picture from it: one triggered by a gpiozero when_pressed callback, and one triggered by a kivy.uix.button…
Drake P
  • 174
  • 9
0
votes
1 answer

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.sleep() to see if the LEDS would stay on, but…
0
votes
1 answer

Python break out of poll when key pressed

Apologies for the newbie Python post, but a bit of Googling and I still can't find what I need. I have the following Pi Hat; https://github.com/modmypi/Jam-HAT, ...and I'm using their docs to guide me;…
Beefcake
  • 733
  • 2
  • 12
  • 37
0
votes
0 answers

Connect a Vandal Switch with Raspberry-Pi and register an Input/Output with a click

I want to connect a Vandal Switch(CPS) with an Raspberry Pi, there i want to register via an Phython program when the Button is Pressed and change the Led light from blue to Red. How i connected the Cables to the Raspberry Pi: Brown cable -> 5V…
Valac
  • 29
  • 10
0
votes
1 answer

Timeout in Python

I am currently programming what can be described as a 1-dimensional pong game with LEDs using a raspberry pi. I am trying to accomplish this using the gpiozero library. What I want is to implement something where once the led is on I start a timer…
0
votes
1 answer

How do I detect a gpiozero Button press while in a function called by another button?

I need to trigger a relay from a Button press and wait for a signal then release the relay. In the sample code below, that signal is b2. I'm new to Python and the Pi but having fun! :) import RPi.GPIO as GPIO GPIO.setmode(GPIO.BCM) from gpiozero…
Tim Duncklee
  • 1,420
  • 1
  • 23
  • 35
0
votes
1 answer

gpiozero -> MotionSensor and LED

I am trying to follow this example. Everything works fine as expected with the following two lines pir.when_motion = led.on pir.when_no_motion = led.off but things stop working when I assign an event handler to pir.when_motion I can see function,…
user2243747
  • 2,767
  • 6
  • 41
  • 61
0
votes
1 answer

Why does tkinter cause an error when I add the code after a button statement from gpiozero library?

I am making a fencing program and am trying to utilize the tkinter gui library. The original code for my program uses the gpiozero library to connect pins to the button. This code works perfectly fine on its own, however when I add the tkinter code…
pranay
  • 25
  • 1
  • 6
0
votes
1 answer

gpiozero button issue with is_held

I am making a pumpkin pi for Halloween and am having trouble with the integration of the button; specifically, the is_held bit. It consists of 3 led lights that make up the candle (1 yellow flicker, 1 yellow "breathing", and 1 orange steady) and a…
0
votes
2 answers

I get an Error when I try to round a gpiozero variable

I want to round a variable, but when I run my code it returns the following Error: "TypeError: type DiskUsage doesn't define __ round __ method". I already looked up in the internet but I didn't found something which can solve my problem. Here is my…
Simon
  • 77
  • 1
  • 7