Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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.

0
votes
1answer
25 views

Is in Python anything like in Java platform.exit() to leave the program [closed]

I got a Button and when the Button was tapped it runs a function. Till here I got everything ready. And now my question I will close the program correct like in the title. Is in Python anything like ...
-1
votes
0answers
50 views

How can I connect the Raspberry Pi to IFTTT without using webhooks?

I know you could use webhooks if the RPI is publicly accessible, but I would like to avoid that. My objective would be asking google assistant to turn on a GPIO pin, then that info magically ...
-1
votes
0answers
21 views

Start and stop saved putty session with python script

Could anybody please help me with the Linux equivalent of this python script? import os, time, subprocess a=0 while True: p=subprocess.Popen('C:\Program Files\PuTTY\putty.exe -load "TEST"') ...
1
vote
1answer
46 views

Trouble accessing Sensirion sht21 though multiplexer tca9548a using i2c and python

I can't reach my sht21 sensor throughout the Multiplexer tca9548a (adafruit). When I run it with python3 in the raspberry pi's terminal, I get this error report: Traceback (most recent call last): ...
-1
votes
0answers
16 views

Raspberry Pi define the USB port currently plugin to apply on Python

How to define the USB port that currently plugins on Raspberry Pi, because the currently plugins on Raspberry Pi is the 2 current RFID, keyboard and mouse. I would like to get the ports of RFIDs to ...
0
votes
1answer
32 views

How can you power on and off devices via GPIO

I have a humidity sensor monitoring but I only want it to monitor for a short time and then I want to power it off. It is 3.3v. I am using CRON to call a script.py When the script finishes I would ...
-1
votes
0answers
21 views

Python - Microphone recognition problem

I'm recording sound perfectly via arecord command. I use MEMS microphone with i2s interface and works well. But also I installed soundmeter program from https://pypi.org/project/soundmeter/, and it ...
-1
votes
0answers
12 views

Use the “enable” pin on the avoid sensor with PiFaceDigitalIO (Python)?

Im using a Raspberry with a Piface Digital2 and writing the code with Python3, using the PiFaceDigitalIO module. Im having a fully functional avoid sensor so far, but i cant figure out how to use the "...
0
votes
1answer
27 views

Using `gpiozero` on `raspberry pi` to control pins, but output pins are reset upon script exit, even though state is remembered between runs

I am using gpiozero to control devices on the Raspberry Pi. When I create a reference to (for example) an LED device, there is a parameter for creating the object without effecting it's current state:...
-1
votes
0answers
18 views

Probleme with motion and command (on_envent_start) when deamon on

I'm new on linux and I'm experiencing some issue with motion. I'm trying to execute a simple python script from motion when an event start . So I have in the motion.conf file the line : ...
0
votes
2answers
542 views

Installing Python 2.7

I am new to the Raspberry Pi, I have a project. I would like to work on Python 2 not Python 3. By default Python 3 is installed on my Pi. I want to change or remove this version and I want to ...
0
votes
1answer
34 views

Invalid syntax in while loop [closed]

cat = True while cat = True: print("cat") else: print("Kitten") I tried to run this program but it says invalid syntax for the while loop.I don't know what to do and I can't find the answer ...
0
votes
1answer
15 views

Camera errors when running Python script at boot from rc.local

I have a Python file that calls the camera to take video when a motion sensor is triggered. I am running it at startup using rc.local (I have the '&' at the end). When I run it normally, it works ...
0
votes
2answers
34 views

Small pulses - DHT11 relay triger

I'd like to trigger my relay to turn on my lamp when the humidity level measured is greater than 85. Here's the code I've been using. import Adafruit_DHT import RPi.GPIO as GPIO import time sensor = ...
0
votes
1answer
45 views

Automatic shortcut execution on boot

I want to achieve following: run my GUI (made in Tkinter interface) application automatically as I boot the RPi (i.e. no desktop screen loading). But I want to be able kill the application so I can ...
0
votes
0answers
52 views

Python script wait for button press before starting/stopping a separate python script

I've written a python script (shown below) which starts and stops another separate python script (datalogger) once a button is pressed. The datalogger script records logic levels (0 or 1) and stores ...
0
votes
1answer
31 views

How can I attach a BTS7960 43A motor controller circuit and control it from a keyboard wirelessly through the Raspberry pi [closed]

I need to attach a BTS7960 43A motor control circuit to the Raspberry Pi. Could anyone please tell me the connections and provide me with a link to a python code to drive motors forward and reverse ...
-2
votes
1answer
38 views

Run a fan 5scs long GPIO

def fan_on(): GPIO.setwarnings(False) GPIO.setmode(GPIO.BCM) FAN_PIN = 23 GPIO.setup(FAN_PIN,GPIO.OUT) GPIO.output(FAN_PIN,True) This is my code to run a fan on my rpi via GPIO ...
1
vote
3answers
122 views

Serial to USB, no ttyUSB0

I'm trying to open a Serial communication between a Raspberry Pi 3 (model B, running on Raspbian) and a device (a traffic counter to be precise). I've a USB to Serial cable, using the rs232 standard. ...
0
votes
1answer
46 views

What are some common software design patterns, when it comes to raspberry pi programming? [closed]

I am kind of confused when I see raspberry pi code for reading sensor inputs, opening lights e.t.c. I am not experienced with python, but I would expect that code is much like in ui programming. ...
0
votes
0answers
23 views

fetching images from firebase storage and displaying in Pi 3

I have sent images to firebase storage from web and now i want to read and display images in my Pi using python for further image processing. But i am confused how to do it? Is the google cloud ...
0
votes
0answers
10 views

Can I have Matlab Engine from my host computer to communicate with the Python I'm executing on RasPi?

In short, I need to use my host computer as an API to control the 3 cameras driven by Raspberry Pi. Just basic stuff like when to stop recording and when to start recording. Change video resolution, ...
0
votes
1answer
20 views

PWM and Output Voltages at High[er] Frequencies

I am attempting to set an analog voltage control signal with a Rasberry Pi 3 B+. My Python 3 script uses RPi.GPIO to output PWM across a range of duty cycles to simulate analog output---without the ...
-1
votes
0answers
27 views

LCD Pulsing message

I've hooked up a LCD display to a project I'm working on. I have many inputs/outputs and I want to display different messages depending on the state of the inputs. Now before I start to complicate / ...
1
vote
0answers
60 views

How can I pause a video of omxplayer with out using keyboard?

I am working on my project that can display video when a magnet (signal ) is detected using a hall-effect sensor. Then after, if the magnet is removed from the sensor the video has to pause (not to ...
-1
votes
0answers
27 views

Building an electronic lock box connected to a Raspberry-Pi+keyboard,

I've been kicking around an xmas idea for my young nieces and nephews. I'd like to connect a small, electronically controlled lock box to a raspberry-pi + small display device + keyboard configuration....
1
vote
1answer
53 views

Install futures for Python 2.7 (pip install futures)

I'm having some problems related to MagicMirror and OpenCV ("No module named builtins"). I think it is because I haven't been able to install futures in the correct version of Python. When I run pip ...
-1
votes
0answers
20 views

TK app startup when initial boot

I have two programs I need to start as soon as the windows manager launches but I'm having problems. I added the startup commands to: ~/.config/lxsession/LXDE-pi/autostart /etc/xdg/lxsession/LXDE/...
1
vote
0answers
80 views

How can I pause video of omxplayer using python script?

I am using omxplayer to play videos. The video played very well. But I can't pause the video using the commands below. Can any one help me how to pause my video using python script? Here, is the ...
0
votes
1answer
71 views

RPI object tracking with multiple objects

I have been reading a tutorial on creating a Rpi colour based object tracking system but have been unable to test it due to me being a away from my Rpi. However I have read through the code and it ...
-1
votes
0answers
46 views

MobileNet classifier (not SSD) with Keras inference time slow on Raspberry Pi

I trained a MobileNet classifier (not an SSD object detector) using Keras with the TensorFlow backend. When I deployed it to my Pi, I was surprised that it takes 20 seconds to make a single inference....
0
votes
2answers
67 views

Python script not running on start up

I have edited ~/.config/lxsession/LXDE-pi/autostart using nano (without sudo) to open a lxterminal and run a simple python script that contains an infinite while loop with a print statement. In my ...
1
vote
1answer
118 views

Is it possible to install a higher version of python-numpy than 1.8.2 on a Raspberry Pi Zero?

I successfully installed most of the python data science packages on my RPi Zero using Geoff Boing's excellent guide. However, the versions of some of the packages seem quite old. E.g. numpy....
1
vote
1answer
41 views

GPIO pin error?

I am trying to have a magnetic door sensor be detected after every time it connects and disconnects. I have looked at this as a guide, but I am stuck at on part when compiling. Traceback (most ...
0
votes
0answers
61 views

Run Python code from PHP

This is probably a Linux question, but concerns specific Pi code. I am using the DHT11 class from http://abyz.me.uk/rpi/pigpio/download.html and have written a program which uses this. #!/usr/bin/env ...
1
vote
1answer
62 views

Saving measured data to text file

Im using an ADC to measuring values and send them over a socket via the RP, yet I also want to save the values to my RP as I'm reading them. For some reason when I open the text file it only has the ...
0
votes
3answers
51 views

Pi Zero Button pressed detected incorrectly

simulate this circuit – Schematic created using CircuitLab I have a script that sends me a firebase notification when the doorbell is pressed. It was working fine when it was on the breadboard. ...
0
votes
2answers
131 views

Raspberry Pi - Connect and power RS485 device

I am trying to connect a Raspberry Pi to a OSDP card reader. The reader communicates via RS485, and is powered by 9-27V DC. Unfortunately, I have not been able to succeed with a serial connection in ...
0
votes
1answer
41 views

Trying to make a timer script with Python but I can't seem to get it working

So I'm trying to make a timer script that will run one relay (on/off) at a given time everyday, then the other seven to perform a function over time or (once started) to be interrupted by a switch ...
0
votes
2answers
90 views

Problem with RFID-RC522 and Raspberry PI Background script

I am working a project to read an RFID tag, and make the buzzer sound. It works correctly in foreground. I call the python script via /etc/rc.local and it is triggered when I execute /etc/rc.local via ...
4
votes
1answer
88 views

Login to Raspberry Pi Via Python Script

I am trying to make a system to login to the Raspberry Pi with an RFID tag. I successfully connected the RFID reader RC522 module to the Raspberry Pi and I can retrieve the number of the tag and write ...
1
vote
2answers
68 views

Python on Raspberry Pi

For my High School final project I will do a portable retro arcade machine. I think Raspberry Pi is a candidate for this application, and I've done some research on it. However, I've not been able to ...
1
vote
2answers
34 views

How to use Config file between multiple pis

I have multiple pi's running a program where they listen for a broadcast message and trigger a python script. My python script that's triggered has config details that is same for all pi's. Whenever ...
0
votes
3answers
301 views

OpenCV 4 error?

When I run the command python faceDetection.py I get the error- VIDEOIO ERROR: V4L: can't open camera by index 0 Traceback (most recent call last): File "faceDetection.py", line 21, in <module&...
0
votes
0answers
48 views

pigpio controlling two continuous servo motors

I am relatively new to controlling gpio pins with python and the pigpio library. I am trying to build a small robot to be controlled with an old xbox 360 remote. I've downloaded and installed all ...
0
votes
0answers
36 views

Raspberry Pi ADC Adafruit_ADS1x15 IOError python 3

I'm trying to find the input from Adafruit's ADC (analog -> digital converter) and when I use: signal = adc.read_adc(0, gain = GAIN) I get: Traceback (most recent call last): ... File "/home/pi/...
0
votes
1answer
44 views

Preventing user from exiting Tkinter GUI program on Raspbian

I am creating a kiosk-mode program for Raspberry Pi, using Raspbian +Python/Tkinter. I need to have keyboard attached, so the user is able to enter a password, but I need to prevent the user from ...
0
votes
1answer
50 views

NRF24l01+ Arduino to Raspberry - Receving working randomly [closed]

I am using a Raspberry Pi 3B+ (RF24 lib) and Arduino Mega (RF24 lib) I have cleaned the pins and soldered a 10 uF capacitor between vcc & gnd The distance between the two modules has no effect. ...
1
vote
1answer
72 views

Datalogging square wave signal using GPIO.BOTH

I'm currently making a datalogger using a Raspberry Pi which will record the real time and date of each falling and rising edge (GPIO BOTH) of a square wave signal (going through one input port). The ...
0
votes
1answer
120 views

running python script as service and calling functions from another program

I have a python script to control some LEDS. In a compiled c++ program I have been calling python scripts like so in various places: system("python /home/pi/leds_flash.py") system("python /home/pi/...