86 questions
0
votes
1
answer
68
views
GPIO readings and OSC forwarding using Python in Raspberry Pi
I am trying to set up a simple Raspberry Pi server that sends an OSC message when a button is pressed. My plan was to read the GPIO using a Python script and send the OSC message to PureData, running ...
0
votes
1
answer
505
views
GPIO pin cleanup
I have used python for a while now, however, I am new to using a Raspberry Pi and things such as GPIO pins. I recently bought a Freenove Ultrasonic starter kit to help me learn. They have a tutorial ...
0
votes
1
answer
72
views
How do I set the initial value of a rotary encoder while using gpiozero?
I would like to set my rotary encoder initial value halfway up an all positive scale.
The documentation describes a parameter value, that I tried to set.
encoder = RotaryEncoder(a=14, b=15, max_steps=...
0
votes
0
answers
347
views
Issues with importing modules with Thonny
I've been trying to get the gpiozero module into Thonny for a while (for use with a Raspberry Pi) and I've been having lots of issues with it. I installed gpiozero using the package installed inside ...
-2
votes
1
answer
103
views
2 timers at the same time [closed]
I am trying to program a practice tree for drag racing. All of the code is working except, I cannot get a separate reaction time accurately from the right lane. If I release the left button first, the ...
0
votes
1
answer
228
views
gpiozero combining button events in event driven code
I'm pretty new to the Python and Raspberry business and am currently working on my first major application. I like gpiozero and the ability to work with events throughout.
I would like to make my code ...
2
votes
0
answers
185
views
Can't control servo with Python using Raspberry Pi
I am using a Raspberry Pi model 4B and a Tower Pro servo SG51R which only turns 180 degrees. I am writing code on the Raspberry Pi to control the servo (which works as I have tested it with my Arduino ...
0
votes
0
answers
144
views
python Raspberry Pi double occupancy of GPIO
I have a Raspberry Pi with an Display and Buttons (here). And I have a program, that uses the Library (in the appendix) from the Display. The program creates a home screen with dynamic apps. Each app ...
1
vote
0
answers
198
views
Raspberry Pi 5 Integrate Sensor With Linear Actuator
Raspberry Pi 5 Using GPIOZERO
I want to integrate my sensor together with my linear actuator in raspberry pi 5. So my goal here is just like the doors in supermarket, it opens automatically when ...
-1
votes
1
answer
226
views
asyncio only running first gpiozero coroutine
I'm trying to make gpiozero play nicely with asyncio in my RPi 4 but ran into an issue that I can't solve. Essentially I'm trying to get the turn signal (clock wise, counter clock wise) af a rotary ...
1
vote
2
answers
1k
views
I am having a major issue with the GPIO in virtual env
When I run this code outside my virtual environment, it works. However, when I try to run it inside my virtual env I receive an error.
Code ran:
from gpiozero import LED
from time import sleep
from ...
1
vote
0
answers
63
views
VLC module for python, video not always start fullscreen
for a project on a Rpi I need a video to be played fullscreen. I was used to work with Omxplayer but as being deprecated I need now to use VLC. Sadly the video randomly start in a separate windows ...
4
votes
1
answer
2k
views
Controlling GPIO from a Docker container in Raspberry Pi 5
I'm trying to use gpiozero to control GPIO in a container on Raspberry Pi 5.
My simple LED blink application is
from gpiozero import LED
from time import sleep
led = LED(17)
while True:
led.on()
...
0
votes
0
answers
142
views
Can't install approxeng.input==2.6.3
I am making a weird robot out of k'nex and a pi and I am controlling it over bluetooth with a DS4.
The motor
The controller
The DS4's D-pad will control the movement. I was looking for librarys to ...
1
vote
1
answer
110
views
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 ...
0
votes
1
answer
4k
views
Servo jittering and not turning fully
I started a project with servos, making a crude robotic arm, with two servos. the issue is, that my servo keeps jittering when stationary, sometimes too much, and can cause the thing to fall over. ...
0
votes
1
answer
49
views
Nested while patterns in Python
I'm a Python beginner trying to write a script for a Raspberry Pi Zero.
The idea is to turn the lights on at dawn and off at dusk, keeping in mind those times change every day. So what i'm after (i ...
0
votes
0
answers
393
views
No output when using the shell_exec() function in php to run a python script that imports a gpio library
I am trying to use php to execute a python script, and then retrieve the output of that script for later use. I am running a LAMP server on a Raspberry Pi 4 (set up according to this article https://...
0
votes
1
answer
34
views
Have a button table instead of a lot of variables
Novice in pyhton AND Raspberry prog, i want to create a Quizz-buzz Game. Up to 8 players can play it.
To catch the event when a button is pressed, (using the gpiozero lib) i want to do something like :...
0
votes
2
answers
395
views
Remote GPIO (Pigpio) with input from laptop and output from Raspberry Pi
I'm working on an object detection project for IoT using a webcam and servo. In short, when the object detected by the webcam matches the data in the system, the servo will move. Can the webcam be ...
2
votes
0
answers
114
views
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")
...
0
votes
0
answers
111
views
python this gpiozero method is not working right of the bat
from gpiozero import MotionSensor
While true:
MotionSensor(17).when_motion()
print("motion detected")
returns error:
Traceback (most recent call last):
File "/home/pi/...
1
vote
0
answers
615
views
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 ...
0
votes
1
answer
291
views
Discord.py program using 100% of a core
I have a Discord bot running in python on a Raspberry Pi 3B+. The purpose of this program is to send the lab status to our server by the push of a physical button. I've noticed that the program itself ...
1
vote
0
answers
124
views
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 &...
0
votes
2
answers
2k
views
how to fix "TypeError: 'bool' object is not callable"
I'm trying to control a stepper motor with python code. I know this may not be the best way but please just help me and bear with me. I got this working a while ago I'm pretty sure and I have no idea ...
-1
votes
1
answer
1k
views
ModuleNotFoundError: No module named 'gpiozero'
I tried to use gpiozero on my raspberry pi 4, when i try to run the code it doesn't find the module.
Any suggestions?
I tried downloading it by several different ways as stated on the gpiozero ...
0
votes
0
answers
653
views
What environment variables do I need to change to allow pigpio to connect to a raspberry pi remotely?
I am using the gpiozero and pigpio libraries to create a remote gpio control application in python. The pigpio documentation advertises this as a feature, so I know it's possible. Here is the ...
0
votes
2
answers
9k
views
Break a while loop when a button is pressed
I am currently trying to setup this code so that when a button in this case button1 connected to a RPi GPIO runs the function c1 and keeps looping that function until another button button2 is pressed ...
0
votes
2
answers
143
views
A function is running despite me changing a variable that should stop it
I was hoping someone could help me with this issue. I'm hoping it's fairly simple to fix, but I have been trying for a while to figure this out. I have trimmed my larger code to this, as I believe the ...
1
vote
2
answers
479
views
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 ...
1
vote
2
answers
542
views
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 ...
2
votes
0
answers
318
views
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
...
1
vote
0
answers
136
views
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 ...
-2
votes
1
answer
1k
views
How to control a GPIO pin on the raspberry pi (general use) (python script)
I want to control a gpio pin on the pi (4B 8Gb ram) with gpiozero.
I can't find how to simply control a pin... without the library thinking that it is a LED.
Coming from Arduino, there you can just ...
0
votes
1
answer
1k
views
Raspberry PI : GPIOZERO on I2C pins
This is on the Raspberry PI.
I was able to get the I2C-1 to work properly on the PI using Python.
Then I ran another Python script that uses one of the I2C pins as a GPIO using the GPIOZERO library.
...
0
votes
1
answer
2k
views
Raspberry PI GPIO Keyboard/Mouse Input
Trying to create very simple keyboard and mouse controller using the Raspberry Pi's GPIO pins. Would love to use the code in a educational setting, so trying to build super easy, readable code for ...
0
votes
1
answer
489
views
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 ...
5
votes
4
answers
4k
views
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 ...
1
vote
0
answers
295
views
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 ...
0
votes
1
answer
845
views
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 ...
0
votes
1
answer
858
views
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
...
0
votes
1
answer
92
views
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 ...
0
votes
1
answer
2k
views
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 ...
0
votes
2
answers
372
views
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 ...
1
vote
1
answer
916
views
RPi.GPIO problems on PI 4b
"This module can only be run on a Raspberry Pi" error when using RPi.GPIO on Raspberry Pi 4b.
This error was caused by the default RPi.GPIO version installed with:
python3 -m pip install RPi....
0
votes
1
answer
278
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....
0
votes
1
answer
281
views
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;...
1
vote
1
answer
406
views
How to test a RGBLED without Raspberry Pi connection?
I was working with gpiozero and wanted to use the MockFactory to debug on a local device without Raspberry Pi (4) connection. The last time I used the Mockfactory was with an gpiozero.LED object. But ...
0
votes
1
answer
720
views
How to send a websocket message from a non-async method?
I am using these docs to get to know websockets from Python.
When everything that is happening 'inside' those async methods, it works fine, but how can I send a message outside of that? In my specific ...