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
2answers
15 views

Pigpio equivalent of GPIO's event_detected() function?

Is there an pigpio equivalent to GPIO's event_detected() function? I need something that is constantly watching for a button press. The code I currently have doesn't consistently detect it (python ...
0
votes
0answers
21 views

Run program on raspbian buster LXDE startup

I know this question has been asked before, but the methods referenced are not working for me. Currently I have done this: sudo nano /etc/xdg/lxsession/LXDE-pi/autostart and added the line @python3 /...
0
votes
0answers
11 views

Can't read from serial0 using PySerial when python script starts at boot

I have a Python script that uses Pyserial, connects to '/dev/serial0' and reads from it in loop. The script works fine when starting it manually after the RPi is up. However, when I added the script'...
0
votes
0answers
23 views

Raspberry Pi Zero W Temperature isuue [on hold]

I have developed an application on raspberry pi zero w with raspbian buster lite. Application is about scanning beacon's mac. To scan the beacon data I took reference from https://github.com/...
0
votes
0answers
19 views

MQTT and Rapsberry PI

When I connect to a newly installed Mosquitto client from my Windows machine it works fine See the python command below : >>> import paho.mqtt.client as mqtt #import the client1 >>&...
0
votes
2answers
31 views

Configure Raspberry pi to run my application before GUI Desktop

I have created an application through Python that has library dependencies on Qt4, pyqt4, pyqtgraph etc. This application is based on Raspberry Pi, I have developed and finished it on the platform. I ...
2
votes
1answer
19 views

Camera access in docker container is generating errors / locking

I am trying to build some machine vision software inside docker containers, it has worked previously, but now both devices are not able to access the camera. It seems to be a configuration/update ...
0
votes
0answers
17 views

Ending a camera video stream in Python / threading

I’m very new to Python and have been struggling with the code for a wildlife camera project on the Pi. I’ve managed to get the PIR sensor and automatic camera capture working, but I’d like to have a ...
1
vote
1answer
29 views

Arecord: “main:828: device or resource busy” when run via systemd service, but works fine from CLI

I have a python script which, when a GPIO button is pressed, launches an arecord process. This records audio from a USB microphone (plughw:CARD=GS3,DEV=0) and pipes it to another program for ...
0
votes
2answers
28 views

RUN RC522 READ Python Script without SUDO [duplicate]

Im working with MFRC522-Python library, I READ the RFid Uid then I open a webbrowser with a specific URL composed by the uid of each card. The thing is in Raspbian Buster (RPI 3b+) cannot run Chrome-...
0
votes
0answers
17 views

NoIR camera - Photo and and video frame size looks different

I'm trying to create a feature matching script using NoIR camera. What I'm doing is take a picture using and compare it with the real time video feed. Everything works fine but the the live video ...
0
votes
0answers
17 views

picamera web streaming and image capture

I am a total python novice so please bear with me... I have combined a couple of the picamera advanced recipes to try and web-stream and take pictures simultaneously. everything works correctly, ...
0
votes
1answer
31 views

2 Motors functioning unevenly - right motor gets more power than the left

I'm trying to execute this piece of code to run 2 motors on my robot. The code is really simple it's just repetitive. For some reason that I can't figure out, the motors run unevenly. Here is the ...
0
votes
0answers
32 views

Is there a way to loop through GPIO pins and a database in python

I have built a set of musical stairs using raspberry pi, motion sensors and python, and a web app to change the instrument using PHP. The python connects to a mysql database storing the instrument ...
1
vote
1answer
29 views

Showing an image on screen attached to Pi via SSH

I am running a raspberry pi3b+ via ssh. There is a hyperpixel4 screen by Pimoroni attached to the Pi and it's working fine. I am trying to display an image on the screen attached to the Pi with a ...
1
vote
0answers
17 views

Python, pygame.mixer, wait for track to end

A little stuck on the last part of this code. I want a random track to play until the end when a switch is switched. I would like the track to play no matter how many times the switch is switched ...
0
votes
0answers
23 views

Interrupt triggers without button pressed what can i do?

I have two buttons: a red and a green one and i want to measure how often each one gets pressed and i want to write into a csv file. The problem is even without me pressing the buttons the pi gets ...
2
votes
1answer
62 views

pi4 no module named gpio

I am trying to import rpi.gpio in my geany on pi4, but it comes with error no module named gpio. The odd is that i updated pip and python and installed successfully with sudo apt-get install python3-...
1
vote
0answers
35 views

Pi freezes when running a script

I'm trying to set up a trap camera using a brand new Pi Zero W with Raspbian Buster but it freezes when I run the python scirpt. originally the code was a bit complicated with multithreading, email ...
-2
votes
2answers
58 views

Runtime warning: This channel is already in use, continuing anyway [duplicate]

I'm trying to fix this code for a robot with multiple sensors. The values of TRIG and ECHO are input through another part of the code. Set this at the beginning of the code def init(): GPIO....
1
vote
1answer
36 views

is the Adafruit read-only script suitable for my project?

I would like to know whether Adafruit's read-only raspi script (described here: https://www.raspberrypi.org/blog/adafruits-read-only/) is suitable for my project. My project is a camera trap that ...
1
vote
2answers
64 views

Can't OpenGL render points and lines on RPi4 (specifically)

How to get OpenGL.glDrawElements(GL_POINTS, ..) (or GL_LINE_LOOP, GL_LINE_STRIP, GL_LINES) to work with the latest Raspberry Pi? I maintain the pi3d module and, though it works on windows, linux and ...
0
votes
1answer
23 views

Pigpio on callback get value

I currently have some code that I found that constantly outputs a value from a digital caliper. However, I want to modify this so that it is inside a function that can return that is returned from ...
0
votes
1answer
34 views

How to get more power out of the (Grove) Electromagnet programatically?

So I recently purchased a Grove Electromagnet + GrovePi+, everything works perfectly. However for the effect, I want to show in my experiment, I need more power out of the Grove Electromagnet. I'm not ...
0
votes
0answers
54 views

Alsa Lib PyAudio error on Raspberry Pi 3b+

I was looking at an old question that gave advice for fixing these errors: ALSA lib pcm_dmix.c:1052:(snd_pcm_dmix_open) unable to open slave ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown ...
0
votes
0answers
20 views

Looking for suggestions digital price cards

Hello fellow raspberry pi users I am looking for suggestions in getting a raspberry pi 3 to create digital pricing for our locations. The idea is to have it pull the price for products from a google ...
0
votes
0answers
25 views

Run curses based python script on start up [raspbian stretch]

I'm trying to auto start a curses based python script on startup of my RPi 3+ (running on raspbian stretch) What I did so far. I've got a python script demo1.py, import curses ...
2
votes
2answers
451 views

GPIO and Python - GPIO.output() not working

I want to program a simple thermostat, but for some reason the commands GPIO.output(21, 1) or GPIO.output(21, 0) do not change anything. In a similar vein, GPIO.setup(20, GPIO.OUT, initial=0) does ...
0
votes
0answers
13 views

Has anyone used spidev library with python 3?

I am currently trying to interface a RPI 3B+ with a flash memory chip using SPI communication. do anyone have a good resource for using SPI communication with memory? What language should I use. I ...
0
votes
0answers
29 views

script works if I run it once, if I run it in a while loop the Pi freezes

I have this python code that on motion detected send images via email and record videos locally (note the commented line): from gpiozero import MotionSensor from picamera import PiCamera from time ...
-1
votes
1answer
27 views

One coil is always active on my stepper motor(ULN2003)

When I startup my pi or stop my script, the led on the ULN2003 lights up and stays. That means that one coil is active and the motor is heating up. At the end of my script I introduced a few lines of ...
2
votes
2answers
33 views

Python script won't load on startup

I have tried like 5 methods to get this script loaded after raspi3 load. #!/usr/bin/python3.7 #sudo python /home/pi/masterBaseInterface.py import socket # Import socket module import ...
0
votes
1answer
17 views

The service error for startup app in a terminal

My Python application needs to run on a Raspberry Pi 3 at startup and in a terminal. What I did: I created a service screenscript.service in /etc/systemd/system a bash file in /home/pi/mydir/screen....
0
votes
0answers
15 views

Binding PiCamera stream to GstWidget

Well, today I began to program in Python and I'm doing a graphical app with PyGtk in Anjuta. My first objective is to get the stream of the PiCamera in a window. But I'm getting problems to manage the ...
1
vote
2answers
56 views

Simple total counter

Looking for a simple input pulse counter for no more then 2000 counts per minute. Right now I have it set if gpio.input(countswitch): data["count"] += 1 which works but I get 100 plus counts for ...
2
votes
2answers
48 views

Play multiple mp3 files

I need to be able to play up to 8 mp3 files at the same time. Is this possible with the raspberry pi 3b+? They need to be started in python code.
0
votes
0answers
16 views

Gpio state manipulation if subroccess is finished?

I have my raspberry pi 3 running a python script that manipulates some strings and according to that they sometimes pipped to minimodem. How can i be sure that the pipped subprocess is finished so I ...
0
votes
0answers
29 views

Read VW Cluster Adapter Over GPIO

So, i'm trying to develop a new cluster using my Pi. I've built the entire thing using a WiFi OBD-II Adapter & Python. Then I hit a stumpling block, OBD cannot read things like Indicators/Cruise ...
2
votes
0answers
26 views

Pin Crosstalk Issue [closed]

I'm working on a quick project with my dad for his condo. He wanted to setup a bunch of moisture sensors around the condo near sources of water (sinks, bathtubs, toilets, etc), which, if triggered, ...
0
votes
1answer
36 views

Would it be possible to set up a security system like the one in jurassic park? [closed]

Would it be possible to set up a security system like the one in jurassic park (the book) using raspberry pi's? If so, how much time would it take, and how much would it cost? Using python as the ...
0
votes
1answer
29 views

How to trigger a capture using Picamera when a particular event occurs (for eg, whenever a specific object appears in front of the camera)

I want to trigger an image capture every time a tyre of a set of moving vehicles appears just in front of the picamera. Is there any way to get this done automatically every time a tyre appears in ...
1
vote
1answer
29 views

Is there a way to see if bluetooth scanning/advertising are running?

I have made a python script based on this github in order to use ble scanning/advertising. This script will run a long time and the Bluetooth thread might have a problem which caused them to stop. I ...
0
votes
0answers
19 views

Unable to call .Py on Raspberry Pi using Plink

I am designing a .bat file that uses Plink to execute python files located on a Raspberry Pi. Ideally a user will click on this bat file to execute python code on the Raspberry Pi without having to do ...
0
votes
0answers
24 views

Error mounting system-managed device /dev/sdb1

I'm making a zip file with Python, but the process is interrupted. dev/sdb1 is already mounted but this error: Error mounting system-managed device /dev/sdb1: Command-line `mount "/home/pi/hrc2"' ...
1
vote
1answer
29 views

Detecting the same RFID tag twice

I have a problem with the MFRC522 library. It seems to me that after the tag was read / written one time correctly, in the next cycle the library always returns 2 on the check whether a card is ...
4
votes
1answer
59 views

How to Monitor GPIO Input Indefinitely Without Recursion

I actually joined StackOverflow to ask this question because I wasn't sure it was RPi specific, but as I was thinking about how to form the question, I realized it might be GPIO specific (for some ...
1
vote
1answer
52 views

Startup files on raspberry pi 3

I have 4 python scripts running continuously. How I can open them in separate windows on startup? I need see the terminals when it's booting up. I tried rc.local: it's working but I can't see the ...
1
vote
1answer
37 views

a python GUI application to display some measured value (with Raspberry Pi)

I am developing a GUI (with python tkinter) application for a measurement system with Raspberry pi. I made the GUI and the code to do the measurement. But my question is how to link them together. ...
1
vote
0answers
22 views

picamera error the second time I run camera.capture(output,'yuv')

I'm getting an error the second time I run camera.capture(output,'yuv'), what am I doing wrong? my code: from time import sleep from picamera import PiCamera from picamera.array import PiYUVArray ...
1
vote
2answers
145 views

Read ip camera stream video on python using opencv3

I installed opencv3 installation link on my raspberrypi 3 and i've tested this, everything is ok, but when i try to read the ipcamera video stream encountered this error self.stream = cv2....