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
1answer
178 views

Python requests.post - intermittent failure when connected to Huawei E5330 MiFi

I have a python script running on startup on a number of Raspberry Pis (model 3). The script watches a serial port for data from an air quality monitor then posts this data to a web server using the ...
0
votes
1answer
218 views

Accessing terminal running in background [duplicate]

I have a python script running on my rpi, which is starts from rc.local file. The script itself is working fine as it should, silently in background without opened terminal window. But in case I want ...
0
votes
1answer
253 views

Python GPIO.add_event_detect works the wrong way around

I have a problem working with some IR Sensors. They are supposed to trigger "my_callback" when they do not sense an IR signal. At the moment they trigger as soon as they DO recieve an IR signal. I ...
0
votes
0answers
2k views

Connecting Raspberry Pi 3 to MSSQL Server using pyodbc

I am currently trying to get my raspberry pi 3 with Raspbian Stretch Lite (November 2017) connecting to an MSSQL Server. I was following this guide and replaced the Driver and the Setup fields with ...
0
votes
1answer
43 views

Modifying what is shown in the uART

I am working on establishing user communication (one may say a basic UI) from the user's PC to my Raspberry Pi, where the RPI would accept pre-defined commands from the user via uART and then process ...
0
votes
2answers
2k views

Raspberry Pi Camera uv4l stream a recording at the same time with Picamera

Im using uv4l to stream from my raspberry pi, and it works perfectly but if i wanna use a python script to record while streaming i'm getting this error: mmal: mmal_vc_port_enable: failed to enable ...
0
votes
1answer
736 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
1answer
3k views

Which camera settings does camera.exposure_mode = 'auto' dictate / supersede?

For example, if I want to change camera ISO with the Pi Camera Module 2, I don't see any difference in images between: camera.iso = 100 camera.exposure_mode = 'auto' camera.capture(filename) and ...
0
votes
0answers
1k views

UART connection between STM32 an Raspberry Pi

i'm trying to establish an UART connection between STM32F4 and Raspberry Pi 3 to send motion sensor data. STM32 C code: /* Includes --------------------------------------------------------------...
0
votes
1answer
509 views

Lighttpd running FastCGI script hangs and give 500 internal error

I'm attempting to use lighttpd and fastcgi to run a small flask application. When I try to start lighttpd, it starts the server just fine, but when I try to connect in the browser, it hangs without ...
0
votes
1answer
110 views

Converting value from light sensor into picamera shutter speed

I'm trying to make a shutter speed variable based on a reading from an adafruit TSL2561 lux sensor. Lux is converted to an Exposure value using the equation in my code below, and then an shutter speed ...
0
votes
1answer
557 views

camer.start_preview() not working?

When I run my python script the contains: import picamera from time import sleep camera = picamera.PiCamera() camera.start_preview() sleep(10) camera.stop_preview() The script just runs and shows no ...
0
votes
1answer
366 views

webiopi write to log when button is pushed

Trying to learn the webiopi and python. I have a simple button to turn off and on a relay. Here is the HTML <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/...
0
votes
0answers
276 views

Why can't my Pimoroni HyperPixel display detect multiple fingers correctly?

I recently bought PIMORONI HyperPixel Display (3.5 Capacitive 800x480 display, driven by internal ADC) The driver is written in Python using the EVDEV lib but there are some problem reading multiple ...
0
votes
2answers
154 views

Can't turn on LEDs through terminal with PWM

I wrote a crappy Python script that should turn on LEDs connected to the GPIO interface. import RPi.GPIO as GPIO import time, sys, json GPIO.setmode(GPIO.BCM) GPIO.setwarnings(False) gpioPorts = [...
0
votes
1answer
338 views

Pi Camera recording function needs to loop each hour

I have made good use of this forum over the past year as I have been creating a birdbox with camera for my mother. Until now I have been able to find an answer to all of my questions but this time I ...
0
votes
0answers
577 views

Want to find difference between two frames, but get a lot of noise because of the auto changing on exposure, brightness…(not sure) of the webcam

As title, I tried to use Raspberry Pi + logitech webcam to find the difference between two frames, the following is the code that I used: import cv2 #capture from camera at location 0 cap = cv2....
0
votes
2answers
921 views

RPi-iOS communication over WiFi

Here’s my plan: have a python script running hardware pwm code for a brushless motor im using. The idea is to have an iPhone have an app where 1. The python code can be interacted with to adjust a ...
0
votes
0answers
589 views

cron job not starting on bootup

I've created a cron job and it does seem to be running. This is the line I've put in cron file : @reboot python /home/pi/Pimoroni/bme680/Indoor-Air-Quality-MQTT.py & I ran the command grep CRON ...
0
votes
1answer
241 views

Can´t run 192.168.45.34/cgi-bin/script.py from another pc

I can run my python script locally from console terminal, but when I try to run it from another pc I get Internal Server Error-500, This is the script I tried to use os, commands and subprocess and ...
0
votes
3answers
4k views

Variable which can be used between a python and php file

I need 14 variables globally whose value can be manipulated by both php and python program. The python program just wants to read the value of the variable. The PHP program should write the value of ...
0
votes
2answers
2k views

function button.is_pressed from gpiozero do not work

Im working on a university project with raspberry and gpiozero. I need to manage the button response to take diferent actions. The problem is that de function button.is_pressed its always true (even ...
0
votes
1answer
1k views

RPI Run a Python script fan speed control while loop until shutdown

So I have recently created a VPN server on a raspberry Pi 2 Mobel B, and I would like to create a script that will read the CPU temperature and change the PWM signal that is fed into a transistor to ...
0
votes
0answers
406 views

waveshare 3.2" LCD touchscreen touch functionality stopped working

I'm using this touchscreen on a raspi zero w and I'm currently working on a python application. I was working with the python serial module since some time and everything was working fine, but since ...
0
votes
1answer
357 views

Very simple flashing 8-LED ring and button on Raspberry Pi 3

This is my first Raspberry Pi project that involves an LED ring with button control, and I have some very basic questions. I am making a halloween costume with a Raspberry Pi and this SparkFun ...
0
votes
1answer
696 views

Multi-User In-Memory Database

For a project I'm currently working on I collect data from different sources (e.g. GPS Dongle, OBD-II, etc.) and displaying them on a small touchscreen display using PyGame and TSLIB. The whole ...
0
votes
0answers
436 views

RP3 to Arduino - Why am I receiving unwanted bytes with pySerial?

I'm new to RP3, but fairly comfortable with Arduino. Maybe this is an easy one. I am trying to use pySerial to send a single byte from a Raspberry Pi 3 to an Arduino Mega 2560, like so: #RP3 python ...
0
votes
2answers
3k 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
0answers
2k views

GPIO callbacks throw segmentation fault

I am using callbacks to sense obstacles in a small robot. A left sensor and a right sensor. Therefore I add an event twice. Now when the callback is called I remove the event and then later add it ...
0
votes
1answer
323 views

Text overlay over video stream when saving to file system

I'am using raspberry pi zero as controller which communicate over UART with external board with five sensors. What I need is a way to save video stream from raspicam to filesystem with embedded text (...
0
votes
1answer
89 views

How can I get the set attribute of each “device” in an array

What I am wondering is how I can loop through paired_devices and get the "name" attribute for each device. This is only a short amount of the code, if more is needed, feel free to comment below. def ...
0
votes
0answers
204 views

After python3 script run I can't run any program anymore

From time to time when breaking a python3 program I encounter a very strange problem. To illustrate it I have taken the screenshot: Started program works (like the htop in the another terminal window)...
0
votes
2answers
116 views

Take a picture when a light source is disturbed

I would like to use a Raspberry Pi camera to take a picture when a light source sent to the camera is interrupted. I have one Arduino (transmitter) sending an ON-OFF Keying (OOK) signal through an LED ...
0
votes
2answers
587 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
1answer
1k views

Play different videos with omxplayer depending on reported sonar distance

I am a new to Python. What I want to do is that playing different videos depends on distance using Ultrasonic sensor. For example, if the distance <= 20, play movie1. if the distance > 20, play ...
0
votes
1answer
144 views

Python: fail to execute gpiozero Button command inside Class

while this code succeeds: def press_on(): print('press') HWButs = gpiozero.Button(21) HWButs.when_pressed = MainApp.init_buts.press_on inside a class, pressing the ...
0
votes
1answer
529 views

PI2 Reading data from RFID RC522 Mifare

so i am trying to get the data from a mifare card and i can't get the same reading i get on windows. On windows my card data is a 10 digit code like: 4852658522 Even though i can dump the data on the ...
0
votes
1answer
2k views

Problems installing Scipy stack for Python3.6 on Pi-2

I am faced with an apparent time consuming problem or something else when I try to install scipy with pip for python3.6 on my RPi2 model B. OS is Raspbian minimal (jessie). I am using a RPi2, and I ...
0
votes
0answers
4k views

Flask running python scripts with different html buttons

I'm trying to build a web page using Flask and Python on my Raspberry pi which has about 20 different html buttons which when clicked will play a different sound file each. So far I have created a ...
0
votes
1answer
549 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
0answers
3k views

programming a robotic arm

i want to programming my robotic arm (5 servo motors) with python ,so i wrote a python code but my problem is that when i try the code lines separately from terminal window it works fine and robot ...
0
votes
1answer
2k views

Reading simultaneous key presses in python command line

How can I detect simultaneous key presses in python running in a headless session, i.e. with no display attached? My goal is to control two motors in a car by pressing keys on the keyboard. E.g. ...
0
votes
1answer
113 views

Unable to access camera through browser

I am writing a Python CGI script that I want to run on my laptop's browser. This script will SSH into two Pis, and give the command to take a photo. The server hosting this script is on one of the Pis ...
0
votes
0answers
419 views

HTTP 500 Error - Debugging??

I've been troubleshooting my RPi and I keep getting an internal 500 error in my errors.log for a script written in python. I actually get 2 errors in the logs, wondering how I would go about fixing ...
0
votes
1answer
3k views

Displaying a continuously updating time stamp on a 10 minute video

My objective is to print a continuously updating time stamp on every second of a ten-minute video recording instead of one that updates every minute. I'm running the picamera module of python version ...
0
votes
3answers
1k 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 ...
0
votes
1answer
1k views

Minimize active window

Is it possible in python to minimize an active window by name or by focus state and, if so, how? For example: I have an open Chromium browser and run a script in python and for five seconds my ...
0
votes
0answers
2k views

Help with video play from within python using python-omxplayer-wrapper

I am creating a visual front end for a computer project. I have previously written some test code and can successfully play videos, loop a video and stop one and start the other to get a transition ...
0
votes
1answer
442 views

Logic Behind MQx Sensors Calibration

Would you please explain the logic behind this snippet of code which is taken from here for calibrating MQx Sensor(s): def MQResistanceCalculation(self, raw_adc): return float(self.RL_VALUE*(...
0
votes
0answers
71 views

Pimoroni scrollphat import error

I am getting an error for both python3 and python2 with raspberry pi 0 and 3 I have tried installing from the git repo and enabled i2c. i2c doesnt put out anything that is out of the ordinary I am ...

1
47 48
49
50 51
55