Questions tagged [python]

Python is a general-purpose, dynamically typed, object-oriented high-level programming language. Interpreters for versions 3.x and 2.x come installed on the Raspberry Pi's most popular operating system distributions.

Filter by
Sorted by
Tagged with
0 votes
0 answers
2 views

How to write a code to toggle switch that will read to custom GUI

Hi im new to the raspberry pi world and im trying to see where to start on creating a code that will read to my GUI from a toggle switch i have as hardware. I've seen alot of push button codes, but ...
1 vote
4 answers
3k views

How to toggle button on and off with gpiozero?

Abandoned post by Unregistered user. 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 ...
0 votes
1 answer
183 views

Button.when_activated event is not firing even though Button.is_active is setting correctly

Thanks in advance! I am using a Pi 3B to detect activation of a sensor on my model railroad layout. The sensor by default only offers a rising edge detection scenario. I decided to go with gpiozero ...
2 votes
2 answers
98 views

Make screenshot of a program without being connected to a monitor

I am working on a project at a company where I read the temperature of a machine with a raspberry pi. I have downloaded the necessary program and can use it through Wine. In addition, I have made a ...
0 votes
1 answer
107 views

How to transmit hand gesture data from a laptop to Raspberry-pi

I am making a hand gesture bot. In this hand gestures are detected from a laptop using image processing (used OpenCV & Python). I don't know how to transmit real-time output wirelessly of image ...
0 votes
1 answer
189 views

Upgraded RPi and lost my functionality using gpio zero

Recently upgraded my RPi and lost my LED functionality I've installed all kinds of things to attempt to resolve this and no success Thanks pi@JASPER:~/controls $ python controlscript.py Traceback (...
0 votes
1 answer
582 views

ShiftBrite - running on Python

I was wondering if anyone can help me out with converting the example Shiftbrite Arduino code into Python so I can run it on my RPi. Here is the example code in question: int datapin = 10; // DI int ...
0 votes
2 answers
738 views

mq5 gas sensor not alerting of leakages

I'm currently using an mq5 gas sensor in my kitchen with the MCP3208 ADC. my code shows a continuous loop of the voltage charge. in the mq5 as it detects gases in the air. It is supposed to print ("...
0 votes
2 answers
4k views

smbus write_word_data command

I am trying to use the smbus write_word_data command which takes three arguments addr, cmd, value - all of the documentation that I can find tells me that I need to specify cmd, but gives no clue as ...
0 votes
3 answers
2k views

Python Script that handles Bluetooth doesn't work when loaded on startup

Background I am using my Raspberry Pi B+ to control a 32x32 LED matrix and I am trying to send commands from an Android app to my Pi over bluetooth to display text on the LED matrix. I am using ...
1 vote
1 answer
916 views

Raspberry Pi - Press for on / Press for off switch

I've begun tinkering with using electronics and am also new to using Python. I was wondering if someone could help me please? What I'm trying to achieve is to use an on/off switch to run a motor - ...
1 vote
1 answer
71 views

Audio cuts out periodically when using audio hat

I am currently live streaming some audio to and from a raspberry Pi Zero W using the waveshare audio hat however I have found that the audio periodically cuts out when I do this. When I used my logic ...
0 votes
2 answers
60 views

BME280 sensor: OSError [Errno 5]

I recently bought a Raspberry Pi 4B along with a BME280 T/P/humidity sensor. I use the bme280 and smbus2 Python libraries to interface with the sensor. For a while it worked pretty well, but yesterday ...
6 votes
3 answers
15k views

Controlling Raspberry Pi GPIO with c and Python

I was searching for C and Python Libraries which support Pi4.
1 vote
1 answer
961 views

py-spidev and ADNS3080

I have been trying a lot to deal with the flow-motion sensor but I couldn't arrive to a clear result. It might be I can't understand the procedure.. I'm using cs1 on raspberry Defining the spi by ...
0 votes
1 answer
56 views

WS2812B LED strip problems

For starters, I'm using a generic 5 meter, 30 pixels/meter, 5V WS2812B LED strip. I've got a 5V/20A (100W) power supply as well. I'm using the adafruit-circuitpython-neopixel library, and my code I've ...
1 vote
1 answer
214 views

OLED 128x128 is not displaying correctly the colors

I'm having trouble using the OLED SSD1351. I'm running python programs with the luma.oled library. When I run a program that uses colors, these are displayed incorrectly, red is displayed like blue, ...
0 votes
0 answers
20 views

OBD Raspberry Pi bluetooth and serial connections issues

So I've been trying to get my digital dashboard code working and I have to connect to the OBD plug to the Pi but ive run into a plethora of issues since then. The first time I did it, the OBD device ...
1 vote
2 answers
73 views

Autostart python programm

i prefer ask you that i'm French ^^ So I will be very simple. I would like, when i start my raspberry a execution of my python file. That is to says, I want that when my pi starting the programm is ...
3 votes
1 answer
2k views

Raspberry Pi 3 & Arduino: [bluetooth.btcommon.BluetoothError: (112, 'Host is down')]

I am trying to send informations from Raspberry Pi 3 to Arduino Uno with bluetooth. I managed to connect the Arduino's bluetooth module with the Raspberry Pi. But I have this error when I execute my ...
0 votes
1 answer
309 views

unable to install drawnow package

when I try to install the drawnow package, there are some mistakes. I type sudo pip install drawnow it returns pi@raspberrypi:~ $ sudo pip install drawnow Looking in indexes: https://pypi.org/simple, ...
0 votes
1 answer
578 views

Listen for certain keyboard input and insert to SQL Server DB

I have a USB NFC reader (acts as an emulated keyboard that types out the 10 digit ID number on the card when scanned). I want an app to listen for this input and when it sees 10 digits, I want it to ...
1 vote
2 answers
2k views

BlueZ BTGATT-client.py WriteValue

I had a successful attempts with BlueZ-5.50 > test > example-gatt-client.py with ESP32 set as HeartRate Sensor Server.I am able to read from ESP32 which i modified to suit the BlueZ example. ...
1 vote
1 answer
540 views

Access the display from a python app running as a service

Problem: The code below can't access the display when running as a service. I have my raspi hooked up to a touch screen monitor in the kitchen and I've attached a Passive Infrared sensor to the GPIO ...
0 votes
2 answers
99 views

SPI clock is not switching on RPi

I need to use SPI for a project I'm working on with a Raspberry PI, but the little bit of test code I wrote doesn't seem to work. #test program for spi import spidev import RPi.GPIO as GPIO from time ...
1 vote
1 answer
3k views

Problems Connecting to Bluetooth devices through python

I am trying to write a simple python script that connects any bluetooth audio device to the raspberry pi 4. I keep getting "bluetooth.btcommon.BluetoothError: (111, 'Connection refused')" Here is ...
0 votes
1 answer
3k views

Scan Distance from Eddystone Beacons

I would like to read an Eddystone Beacon using my Raspberry Pi 3 to calculate distance from the beacon. I can't find any resources to do this from the official Eddystone documentation. How should I go ...
2 votes
1 answer
958 views

Rpi Zero W - How to automatically accept bluetooth pairing and log mac and info request?

I am using Raspbian Stretch 9.4 on a Zero W. The goal is to deploy it headless for long periods of time where it will broadcast a specified bluetooth signal. When someone tries to connect to it, it ...
0 votes
0 answers
43 views

RPi Zero as 4-pin-fan-controller: Faulty RPM readings on open collector with gpiozero

Introduction and Goal Disclaimer: I do not have profound but basic knowledge in electronics and hardware and my python is a bit rusty. For tl;dr, jump to the problem section below. Hello, I'm trying ...
0 votes
0 answers
55 views

Issue in installing mediapipe on Raspberry Pi 3B

I am trying to install mediapipe on my Raspberry Pi 3B running Raspbian GNU/Linux 12 (bookworm) on ARMv7 Processor rev 4 (v7l). I have created a virtual environment, venv and already installed opencv-...
0 votes
1 answer
616 views

Buffer size for /dev/ttyS0 in python

I got a Raspberry Pi 4 processing Lidar data (RPLIDAR S2) with python (PySerial library). The lidar sends data in chunks of about 50-60 bytes at 1000000 bps over serial. When I use a USB Serial FTDI ...
0 votes
1 answer
303 views

Cannot turn web streaming into a function

I'm working on a project with my Raspberry Pi 0 and a camera. I'm writing my code in Python using the PiCamera module. This file handles setting up the camera and Starting Web streaming. I had no clue ...
0 votes
0 answers
30 views

ALSA issue with Raspberry Pi 4b and voice recognition

I get the following error, and it does not return the speech_recognition information: Expression 'GetExactSampleRate( hwParams, &defaultSr )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: ...
0 votes
1 answer
3k views

RFID RC522 Reader & Chromium Web Page

I'm having a bit of difficulty locating a specific example, however I have found people referencing that they have accomplished what I am looking for. At a basic level, I have a webpage being served ...
1 vote
1 answer
6k views

Error trying to install python-firebase on Raspberry Pi 3

I have installed requests but I'm unable to install the python-firebase package. I want to fetch data from firebase on my Raspberry Pi 3. I have used the following code to do the same on my PC. from ...
0 votes
2 answers
2k views

Raspberry pi 3 reading serial port

I have a python code that reads the serial port of the raspberry pi 3to obtain GPS positions from a fona808. The code works for some time and then throws this error. Traceback (most recent call last):...
1 vote
1 answer
20 views

Sending UDM message from Raspberry via SIM900a GPRS module in python. 1nce provider

I'm trying to send a UDP message via GPRS service from Raspberry but nothing happens. Here is my code. Any advice? Sorry, but this is my first question on StackOverflow. Thanks import time import ...
0 votes
1 answer
51 views

Read Location from SIM868 while using as PPP(Modem Mode) on Raspberry

I trying to get device location using linked sim868 shield on Raspberry 3A+. State: I have got successfully get device location with AT+ commands via UART protocol using Python. State: I have got ...
0 votes
1 answer
439 views

Running python GUI application with PyQt and python-vlc as a service

I'm trying to run a python GUI application as a service. The application is using PyQt5 and python-vlc packages. I have the following service file: [Unit] Description="Python VLC Service Test&...
1 vote
2 answers
3k views

Kivy won't listen to "fulllscreen" setting

Working on a Raspberry Pi Model 3 B, running raspbian. Running Kivy v1.9.2-dev0 and Python v2.7.3 Trying out one of the Kivy examples but for some reason the application won't come up in "Windowed ...
2 votes
1 answer
2k views

Problem with GPS module and Python

I copied a program from the Adafruit webpage to test my GPS module and before running it I installed the Python gps with sudo apt-get install python-gps but when I run the program I get this error: ...
0 votes
1 answer
645 views

Kumantech 3.5" LCD Touch Display, Python Library

I've a Kumantech 3,5" LCD Touch Display in front of me. I'm trying to find a python library to controll the LCD, because i don't want to use x or just to console. I couldn't find any. And I couldn't ...
0 votes
1 answer
1k views

Problem with i2c communication between arduino and raspberrypi

I have connected Rpi with Arduino using i2c communication. Pin Configuration: Rpi ---- Arduino Mega SDA SDA SCL SCL GND GND I also have an encoder attached to Rpi. Encoder `------ Rpi 5V 5V Gnd Gnd ...
0 votes
2 answers
65 views

Automatic execution of a Python script using a Raspberry Pi 4

Im programming on a Raspberry Pi 4 and trying to make a python script start automatically, when powering on. The python script is working and has no errors. I tried to insert a starting command in /....
1 vote
1 answer
2k views

PSUTIL: module 'psutil' has no attribute 'getloadavg'

I'm teaching myself python with the aim of building a small, off-grid server for collecting/transmitting data on my rpi. One of the datasets I'd like to collect is the CPU load by making calls to ...
1 vote
2 answers
1k views

can't get audio to play from python, on raspberry pi

I have a Raspberry Pi 3B+ For speaker, I have some ear phones plugged into the 3.5mm audio jack. If I try pi@raspberrypi:~ $ omxplayer ./mario1.mp3 Audio codec mp3float channels 2 samplerate 44100 ...
0 votes
1 answer
1k views

Audio Processing Issues in PyAudio in RPi

Basically, I want to analyse the spectrum of the input audio stream to my Raspberry Pi. I have configured my Audio USB Adapter and ran sample tests on Play and Record. I am using PyAudio to take ...
1 vote
1 answer
67 views

controlling a continuous servo in both directions

I'm using a Fitec FS90R continuous servo with my Raspberry Pi Zero, and trying to make it turn slowly in either direction (it's controlling a small turntable with a display on it). My test script is ...
0 votes
2 answers
770 views

How to solve segmentation fault error on raspberry pi 4

I am currently trying to use yolov8 to perform object detection on the raspberry pi 4. I have installed ultralytics and other necessary packages but whenever i run the code on the terminal it says &...
1 vote
1 answer
518 views

Access GPIO pins through a Flask + Apache/mod_wsgi

I get an internal server error when I import the gpio pins library in my simple __init__.py file. And the debugger doesn't show up. As I understand it, the server doesn't have the permission to ...

1
2 3 4 5
65