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
1
vote
2answers
37 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
15 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
28 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
9 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
10 views

Parallel Rpi Cam

I am planning to build a multispectral camera using 1 Pi NoIR cam and 1 Pi Cam. However, I've read a book wherein it uses two raspberry Pi's in order to capture 2 images using these 2 cameras ...
0
votes
0answers
18 views

A web app on Raspberry Pi which can access a database [on hold]

I'm planning to make a small to save time in the office work. I have some Excel sheets and I want to turn them into a database. Then I want to use Raspberry Pi to host a web server, then make a web ...
0
votes
0answers
18 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
17 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 ...
-1
votes
0answers
8 views

pocketsphinx.c - Writing raw audio file - segmentation fault

I am working on a smart home system project that uses speech recognition. We have 2 raspberry pi devices. The source code, written in python, works perfectly on one of them but crashes on the other ...
2
votes
2answers
411 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
12 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
23 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
26 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
30 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
11 views

The service error for srartup 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
10 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
53 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
28 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
15 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
25 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

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
33 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
26 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
26 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
14 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
21 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
22 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
55 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
46 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
35 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
64 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....
0
votes
0answers
19 views

is there a way to minimise the effect of the Pi on the Sense HAT's temperature sensor?

Is there a way to minimise the effect of the Pi on the Sense HAT's temperature sensor? I cannot seem to reduce it from mid to high 30s deg. C. Or do I really need a sensor that is external to the ...
0
votes
1answer
29 views

Having a sound clip play and be looped as long as the button is pressed down and stops as soon as it is released

I am able to have the script running when I have the code set to pygame.mixer.music.play but if I do pygame.mixer.music.play(loops=-1) I get an error stating CallbackSetToNone: The ...
0
votes
0answers
21 views

Input/output error using Python ADS1115, and a Raspberry Pi

I am trying to read an analog signal using ADS1115 and a raspberry pi. Sometimes it reads and some time result into error. Following is the code snippet response = {} adc = Adafruit_ADS1x15.ADS1115(...
0
votes
0answers
23 views

Execute Python-Script on MotionEyeOS

I've recently created a Card with MotionEyeOS for the Raspberry Pi. I've tested motioneyeos already on DietPi and the normal Raspbian, but it didnt worked with the original Raspberry Pi-Camera. In a ...
2
votes
0answers
28 views

Safe cut power supply from raspberry

I want to cut safe the power supply from the raspberry with a relay connected to the gpio. I know how to connect to relay to the board but.. When the relay turn off the power line will be cut off to ...
0
votes
1answer
48 views

I think I fried my Raspberry Pi, but I'm not sure

I was making connections from my Raspberry Pi to a relay module. While I was running some sample code, I noticed that after I had terminated the program I was still getting a high CPU usage (around 60%...
1
vote
1answer
26 views

Pausing code execution till a button is pressed

I'm trying to pause code execution till a button is pressed and this is what I came up with. I have not tested this but can anyone tell me if this is the right way to go about it? Button 'pressed' is ...
0
votes
2answers
83 views

How to wire a Raspberry Pi to a 16 channel relay module? It won't work

A am using working on a project that requires a camera analyzing some images and activating the appropriate GPIOs to control a relay board. I currently have a touchscreen display, a Raspberry Pi Cam ...
1
vote
0answers
14 views

LED Strip on Raspberry Pi Check if its On - Neopixel

How can I check if the one pixel is on or not? Is there any function for that. I've googled but couldn't find anything helpful. import board import neopixel pixels = neopixel.NeoPixel(board.D18, 17) ...
1
vote
0answers
16 views

Is raspberry able to retrieve/store some n time prior a trigger with multiple cameras?

I came across a project idea which I think would demand a lot from a raspberry pi and arduino hardware capabilities. From my understanding, a master raspberry could be used to trigger n slaves through ...
3
votes
1answer
292 views

Can the Raspberry Pi 4 better distribute Python scripts to all four cores?

This relates to previous questions regarding the GIL (Global Interpreter Lock) for Python on the Raspberry Pi. My question has to do with the new processor on the Pi 4 - does it still have the same ...
0
votes
0answers
31 views

Sending data between PC and Raspberry Pi

I have been trying to send data from my Windows PC to my Raspberry Pi 3 for a python controlled speaker project. I am using TCP sockets which I don't know much about. Client code (PC): import ...
0
votes
0answers
12 views

If I get Anaconda for Raspbian, how will it affect the existing Python installations?

In Raspian, I got Python 2(IDLE) and Python 3(IDLE) already installed. I'm more used to working with Anaconda with all its included packages. I'm just not clear if I install Anaconda, will I get an ...
-2
votes
1answer
40 views

Start program when a device connects to local wifi

I'm looking for a python program that could detect when device has connected to a local wifi and start a specific program. And would communicate via SMS with raspberry pi.
1
vote
0answers
23 views

Use OBDII over WiFi

I think i've tried everything at this point, and nothing seems to work. I'm using an ELM327 WiFi Dongle, connected it to the Pi, created a socat using: sudo socat pty,link=/dev/ttyUSB0,waitslave tcp:...
1
vote
1answer
30 views

Timeout function for user input on 4x4 membrane keypad with pad4pi

I'm making a python script for a 4x4 keypad that's connected to a raspberry pi where the user enters a 4 pin code and the program tells the user whether or not it's correct. In order to take in the ...
0
votes
2answers
100 views

How to find available space and free space if low [closed]

I need to programmatically be able to see how much space is left on the SD card and if it is low delete some files. I'm not sure how to go about getting the value of the SD card space and then saving ...
0
votes
0answers
19 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 ...