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
2 votes
1 answer
2k views

Issues with Kivy on Raspberry Pi 3 with 3.5 in Touchscreen

I followed every guide I could find on installing Kivy to Raspberry Pi. My touchscreen works totally fine. Trying to launch various Kivy demos will result in what seems to be a partial launch, but ...
2 votes
2 answers
392 views

How to send data to a Pervasive eink display via Python?

I got a 5.8" eink display from Pervasive Displays and cannot get it to work, I feel that only a little bit is missing. After a lot of struggle I managed to run it via their sample C code, but the ...
0 votes
1 answer
41 views

"Most direct" way to display an image on Official Display from Python

I have a Raspberry Pi 4 connected to an Official 7' Touchscreen Display that I want to display some data on, ideally from a Python application. What is the "most direct" way to go from an ...
3 votes
1 answer
724 views

Is it possible to connect a Minecraft Pi Edition Python script to a specific active game window?

Is it possible to connect a Minecraft Python script to a specific active game window when multiple game windows are currently open? For example, I have three different open games on one Raspberry Pi ...
0 votes
1 answer
809 views

Python code cannot detect my i2c address

I would like to ask some opinions regarding i2c communications with pca9685. My i2c1(SDA=GPIO2, SCL=GPIO3) of my rpi 4b is used by my mpu6050, which I had to enable one more i2c channel of my ...
0 votes
0 answers
21 views

'make' command not working on my Raspberry Pi while compiling the SocketCAN driver

Problem: When running "make" command I am met with errors I've been trying to install a SocketCAN driver on my pi device so I can communicate with a USB CAN Adapter. I've been following ...
0 votes
1 answer
2k views

Wiegand GPIO read not working all the time. Works most times but hangs on some reads

I'm extremely new to Python, I've been learning a bit over the last couple weeks. This is what I've managed to come up with. I'm pretty over the moon the code works most of the time but it doesnt work ...
0 votes
1 answer
133 views

gpiozero's wait for release not working as it should

I'm trying to build a program that has 2 inputs connected to 2 limit switches and each of these needs to be first opened and then closed before the function respective to each button begins. As a ...
2 votes
1 answer
945 views

USB audio from Pygame

I am running Raspbian Stretch. I've connected a USB sound device and selected it through the graphic interface. This sends the sound out fine from youtube in Chrome but is silent with a Python ...
1 vote
1 answer
1k views

Bluetoothctl connect TIMEOUT exception

This is the error I am getting when I connect to my mobile phone using the connect method in this documentation: https://gist.github.com/egorf/66d88056a9d703928f93, raise TIMEOUT(msg) pexpect....
0 votes
1 answer
106 views

did I fry Raspi I2C pins?

So I wanted to test a sensor I have on the pi, the sensor has on-board level switchers supports both 5V and 3.3V with a 10k pull-up resistor for both SCL/SDA, Mistakenly I wired the Vin into the 5V ...
0 votes
1 answer
976 views

Sense Hat RGB Code

I am a new programmer, trying to learn python. I am using the sense hat to mess around with, I want to make it like rotate RGB colors. I am using the sense.set_pixel and passing in the x,y and r,g,b ...
5 votes
1 answer
242 views

Problem sending analog read values over serial

Ok I apologize as I have edited this quite a bit, but I have narrowed down the problem a bit more. For some reason I can't transfer values from my arduino analog pins?? I am trying to send values ...
0 votes
1 answer
2k views

NoIR V2.1 camera auto white balancing

I have a Raspberry Pi NoIR V2.1 camera. I am working with the NIR (940 nm) LEDs and I saw that I was getting funny/weird colors, so I assumed that it is due to the white balancing, so I switched off ...
1 vote
1 answer
3k views

pure python mjpeg streaming?

I tried the mjpegStreamServer from here but it doesn't seems to work... First of all, most times, after run it throws errors: — Exception in thread Thread-1: Traceback (most recent call last): File ...
0 votes
0 answers
7 views

Reading from MT6816 magnetic encoder with SPI connection using Python on Raspberry Pi 4

I am totally new to the field, don't really know what I'm doing and in need of help. I'm trying to read an absolute angle using an MT6816 14-bit magnetic encoder via SPI connection using Python on ...
0 votes
0 answers
15 views

Python - Way to interact with GUI by executing start - Raspian OS

I want to interact with the GUI of my display(Open an image every time I press a button that I have interfaced via GPIO) via a python script which is executed after bootup. (I have edited crontab file ...
0 votes
1 answer
942 views

Concurrent task handling on Raspberry Pi specific applications

I'm hoping that this is more relevant to the RPi exchange as a lot of my key concerns relate to issues with GPIO/PWM/serial bus usage with concurrency. I'm currently writing software for a robotics ...
0 votes
0 answers
18 views

Pi4 python OpenCV timeout

I have been having some issues with getting a video stream from my cameras on my Pi4B. I am running this on Python. I have been getting the error; VIDEOIO(V4L2:/dev/video0): select() timeout with the ...
0 votes
0 answers
28 views

rc. local not working

I have an issue with opening Python script at startup. I have added python /home/serhii/Desktop/Packed/Hello.py & to rc.local and the script does not open. But, the command sudo pigpiod is working....
0 votes
0 answers
21 views

Can't install RPLCD on rasberry Pi

I can't install module RPLCD on Python 3.11.2 I tryed "pip install RPLCD" = no command "pip", tryed "pip3 install RPLCD" - no results. I also tryed "apt install ...
1 vote
1 answer
162 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
1 answer
509 views

Threading using Python in Raspberry Pi for GPIO inputs

My self-working on encoders of differential drive robot, I need to read the speed and position of wheels using two encoders simultaneously. I have used the threading library in Python even though I ...
1 vote
1 answer
40 views

Using init.d to Start Script Driving Hardware PWM

I'm using init.d to start a Python script on boot. The script employs hardware PWM. When I run the Python manually as the pi user, it works fine. When I start the script manually, calling the daemon ...
4 votes
4 answers
5k views

DS18b20 sensor disappearing and turning into "00-00.."

I've read so many issues similar to mine, but haven't found any clear answers, hopefully someone will know. I have a DS18b20 installed on pin 4 with a 4.7k resistor, all settings appear to be correct ...
0 votes
1 answer
1k views

Raspbian Picamera web stream and record

I've been searching this for a while and I found a few posts that look interesting but it doesn't do what I really want. I am trying to set up a Raspbian security camera that records the video to a ...
0 votes
1 answer
184 views

How to selectively read Mifare blocks with an NFC reader?

I want to use a RPi combined with a RC522 NFC reader to make a Mifare card-based authentication system(1). I am struggling with the capacity to read selected blocks of data on the NFC card. I have ...
0 votes
1 answer
20 views

ESC, BLDC control with pigpio: set_PWM_dutycycle or set_servo_pulsewidth, and other ESC questions

I am new to Raspberry Pis. I am using a Raspberry Pi 4. I am trying to control a BLDC motor from the BLHeli_32 ESC, using PWM signals output from GPIO pin 18. For this project, I need the motor to go ...
0 votes
1 answer
177 views

RPi 5 PyQt5 Install Error

I need to download PyQt5 for a project on my Raspberry Pi 5. I opened a Virtualenv and downloaded other libraries. But I got the following error when downloading PyQt5. Looking in indexes: https://...
0 votes
0 answers
19 views

Problem when testing module DAC MCP4922 with Raspberry Pi

I'm encountering an issue while testing a custom-designed DAC module that utilizes an MCP4922 chip as its primary processor. The vendor provided C language test code for ESP32-S3, but I intend to test ...
1 vote
1 answer
649 views

Control on-board led triggers from python

I know the trigger for on-board leds can be controlled from the command-line (or a script) I have a python program that I want to temporarily take over the system led blink it a little and return ...
0 votes
1 answer
133 views

Where does Pico micropython print go with main.py?

If you load a main.py file onto the Pico with micropython firmware running, it will run on startup. I can tell that this is working because I observe GPIO outputs changing, etc. However, I'm not sure ...
1 vote
3 answers
1k views

errors trying to import numpy on rasperry Pi 4 B

I am using the most recent version of Rasperry Pi's OS on a Pi 4 model B. Apparently the version of python that comes with the OS is 3.9. I'm not sure if Numpy comes with it or that I installed it ...
0 votes
1 answer
229 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
130 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
109 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
296 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
584 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
773 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 ...
1 vote
1 answer
938 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 - ...
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
73 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
1 answer
85 views

Why did my servo motor break when controlling it from a raspberry pi?

I was trying to control a Tower Pro SG-5010 servo motor using a Raspberry Pi 4, with the python code below, but after working for a minute or so, the servo started not turning for some of the commands,...
9 votes
3 answers
20k views

Controlling Raspberry Pi GPIO with c and Python

I was searching for C and Python Libraries which support Pi4.
-1 votes
0 answers
17 views

Control the robot and show the Livestream in the same time

I want to show the Livestream behind the buttons without pressing "link to video feed" This is the html code: LIVE STREAMING - Surveillance Robot a { ...
1 vote
1 answer
965 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 ...
1 vote
1 answer
236 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
1 answer
53 views

import picamera2 module not found when run in script with python3.8

Why would it be that a module could be imported via command line, but not via script? As you can see below, I can import picamera2 in the first attempt via terminal, but when I'm running scripts the ...
1 vote
2 answers
76 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 ...

1
2 3 4 5
65