Questions tagged [python-3]

Use this tag when referring to the Python 3 language. This can include discussions about specific features unique to the language or perhaps when referring to software that requires Python 3 in order to function. Note that general programming questions are often better suited to Stack Overflow; use this tag only where directly relevant to the Pi.

Filter by
Sorted by
Tagged with
0
votes
1answer
2k views

How to interface MLX90614 temperature sensor with Raspberry Pi

I have a mlx90614 sensor and I am interfacing it with raspberry pi 3 B+. I am using adafruit library python. Below is the code: import Adafruit_GPIO.I2C as I2C I2C.require_repeated_start() class ...
0
votes
2answers
23 views

Pyserial, Python3, and RPi not working together

I'm trying to get a TTY to USB converter hooked up with my Raspberry Pi. I'm using Pyserial to setup the connection and write data to the port in a script called pc_test.py. For some reason the script ...
1
vote
1answer
263 views

HC-SR04 Ultrasonic Senor Wiring, Operation, and Python Programming Problem

I'm using a Pi Zero W with a soldered project board to interface two ir Sensors and trying to make an HC-SR04 sensor work. I'm using the 5v supply to power all three sensors. I've set up a Motion.py ...
12
votes
2answers
32k views

Updating Python 3.7 to 3.8 on Raspberry Pi

I recently updated my Raspberry Pi with sudo apt update and sudo apt full-upgrade to the system. Even if Python 3.8 is out, when I run python3 in terminal, it shows me version 3.7, instead of 3.8. Why ...
0
votes
1answer
21 views

Autostart random video script throws IndexError

I am trying to autoplay a random video from an attached usb volume upon boot on my Pi 4 Model B Rev 1.2. The following Python 3 script works within Thonny, popping a Tk message box with the randomly ...
1
vote
1answer
640 views

Raspberry Pi 4 to Mitutoyo Digimatic interface

I've been trying to interface a Mitutoyo digital caliper. I used the code from here and I think I made the right corrections according to the posters comments but as I checked he was last online in ...
1
vote
1answer
697 views

Raspberry Pi notorious problem = cannot find INSTALLED module

I could not use module keyboard, I have check using python3 -m pip list to check the pip packages that I have installed and I saw that I have installed keyboard 0.13.5, however after I execute this ...
1
vote
1answer
325 views

Camera pretrigger capture

Hi i want to make a program that will continually record a video and on a press of a button, it will save 2 minutes before i pressed the button is it possible to do it somehow ?
0
votes
0answers
27 views

Not Able to Change Volume with Cron (tried Python)

Alright, I've been trying this for several days and I'm just dying here... I am putting together a kiosk that should play video. I'm using a NUC with Raspberry Pi Desktop. Everything works but ...
1
vote
1answer
503 views

Allowing a venv instance of Python access to I2C

I'm trying to run a python script using the adafruit_bme280 library to read a couple of sensors and display the data on a flask-generated page. I've gotten it to work outside of a venv virtual ...
0
votes
0answers
17 views

Raspberry Pi 4 b+ with SIM900A Module Error

I'm working on a project that includes send a SMS message. I have tried connecting my raspberry pi with sim900a. Having problems with communication with sim. I've tried using AT commands with minicom ...
1
vote
3answers
2k views

Raspberry Pi won't recognize nRF24L01+

I'm a Raspberry Pi n00b and a python beginner, but I have a lot of experience with DIY electronics, arduino and c#. I've tried everything I can think of, and I just can't get the Pi to recognise the ...
1
vote
1answer
1k views

imutils VideoStream(src=0) return VIDIOC_QBUF: Invalid argument in raspberry pi

I am only doing a simple code in my Raspberry Pi 4: from imutils.video import VideoStream # initialize the video streams and allow them to warmup print("[INFO] starting cameras...") webcam = ...
0
votes
1answer
48 views

Raspberry Pi Zero W taking 38 seconds to boot, how can I speed it up?

I'm using Crontab to start a python file with the code: @reboot sleep 5 && Sudo python3 /home/pi/file.py The file uses the internet to retrieve some JSON data and display it on a screen ...
0
votes
0answers
41 views

How to control door opener from raspberry pi?

I am trying to control a 6V DC door opener which requires 660 mA current supply. Since the Pi only tolerates a maximum of 5V without a relay. As per my research I need a solid-state relay with ...
5
votes
1answer
89 views

raspberry pi 4 using SPI 4 & 5 at the same time causes kernel oops and crashes the whole system

intro i want to use multiple SPI busses at the same time. but when i use to use SPI 4 and SPI 5 at the same time it crashes the whole system it doesn't crash instantly sometimes it takes 10 seconds ...
0
votes
0answers
6 views

is that a way we can boot Fast Compute module 3+ using QT5 Application on start

i am working on compute module 3 plus. and os is respbian buster. I need only wifi and usb services . so please could you please help me how can i boot the fast. because compute takes more than 20 sec ...
1
vote
1answer
326 views

Need assistance hooking up Sharp GP2Y0A41SK0F IR sensor

So I have this... Infrared Proximity Sensor Short Range - Sharp GP2Y0A41SK0F & 1 MCP3002. I have been scouring the web for hours, trying all code examples and I still get 0 as a reading no matter ...
-1
votes
2answers
88 views

Raspberry pi 4 gpio pins not working

My Raspberry pi 4 gpio pins are not working for some reason I tried uninstalling and reinstalling rpi.gpio and gpio and it did not work here is the code import RPI.GPIO as GPIO import time led = 26 ...
2
votes
1answer
1k views

Pigpio not calling Callback for first rising or falling edge

I have some sample code (taken out of my larger program) that regularly (but not always) missing the first rising edge: #!/usr/bin/python import pigpio, time def callback(g, l, t): print("Callback ...
0
votes
0answers
32 views

How to enable guests to join a captive portal in a new local network?

I am reading online tutorials about setting up captive portals for my raspberry pi using python, they all require an active internet connection to setup. My question is: If I setup the Pi in my own ...
1
vote
1answer
307 views

I'm wanting to get user input from a screen, but I can't have any buttons

I'm developing an python3 application that only uses a handheld scanner for input. I need to prompt the user for input and want to use a nice window to do it. When I look at tkinter, it appears that ...
0
votes
1answer
2k views

Stream Deck Using PI 2

I have a RPi2 1gb. I've recently got a touch screen for it and have decided that I actually should use it for what it was intended for. Programming! So my adventure starts here. I want to make a ...
0
votes
1answer
56 views

Error when installing acconeer-python-exploration

I am trying to install this on my Pi https://github.com/acconeer/acconeer-python-exploration . There are some requirements written in the file requirements.txt that need to be installed first. I've ...
-1
votes
2answers
152 views

RPi.GPIO: multiple buttons one callback function, ignore buttons while callback is executing

I have 4 buttons connected to my Raspberry Pi that call the same function when pressed. I'm using GPIO.add_event_detect to connect the buttons to the callback function. When one button press executes ...
0
votes
1answer
829 views

Why does a communication over SPI returns garbage?

I am trying to read from a gps module NEO-6M using Raspbery Pi 3 B over SPI. It nicely works with Arduino but it doesn't want to work with Raspberry. I have used different libraries in Pyhon, even ...
0
votes
0answers
27 views

i need execute code when user input number in terminal in python3

I have this python3 code. import RPi.GPIO as GPIO import requests payload = {} headers = {} GPIO.setmode(GPIO.BCM) GPIO.setup(14, GPIO.OUT) string = input() def buclick(event): url = "http:/...
-1
votes
1answer
44 views

How can I use pigpio to "sniff" and collect data exchanged along an existing USB connection between two devices?

A controller module (power supply) for piece of scientific equipment in our lab uses a Windows program on a PC for a human interface via USB connection. I have a list of the "set" and "...
0
votes
1answer
62 views

How to transfer large amount of data (100Kbytes) over SPI?

Related/previous question here. I'm looking to do a data logging project that involves transmitting data from an FPGA to a Raspberry Pi 4 through SPI. The FPGA will transfer 250,000 bytes ...
0
votes
0answers
12 views

how to install onnxruntime on raspberry pi 3 [duplicate]

I want to setup onnxruntime python library on raspberry pi 3 and I tried some ways to install it but I couldn't . the ways that I followed are : 1 - way1 2 - way2 3 - using pip3 I want to know is ...
0
votes
1answer
485 views

Dependencies fail to install, cannot install picamera on pi3

When I run apt-get install python3-picamera it fails with different dependency issues like: files list file for package 'libparams-util-perl' is missing final newline or files list file for package '...
0
votes
1answer
25 views

How to run root in autostart

I have successfully launched a python script using "LXDE-PI" autostart function, however, this script needs to run as root in order to function correctly. How can I do this? Where would I ...
1
vote
3answers
156 views

Problem running a Python3 script at startup with lxsessions

I have Raspbian Buster on a RPi4 and I was launching a Python3 based Kivy 2.0 app at startup. Since it is a GUI app that needs networking and bluetooth. The only way to make it work was an executable ...
2
votes
1answer
554 views

Retrieve data from Smart Plug via Raspberry Pi (need help with python script)

I am using a tutorial from BeardMonkey in order to retrieve and store the measured data from a smart plug (a smart plug is monitoring the power consumption of my kettle at the moment) https://www....
0
votes
0answers
36 views

HELP - Bluetoothctl Scan in Python3

I'm new to python and with bluetoothctl and I need to automate the bluetoothcl scan on process in python so that I just need to open the python file and start scanning right away. I've been doing a ...
0
votes
1answer
2k views

Get time in microseconds (a 8 digit number) in python3

I am converting an Arduino code to python3. I am trying to read data from IMU 9250 sensor from the I2C interface of raspberry-pi. I am facing issue with the timing libraries of raspberry-pi and ...
0
votes
4answers
154 views

Crontab won't run python script

I'm trying to run two simple python scripts from crontab: crontab file: @reboot /usr/bin/python3 /home/pi/init_server.py @reboot /usr/bin/python3 /home/pi/scheduler.py crontab log: Aug 12 10:07:11 ...
0
votes
1answer
2k views

After installing python 3.6 most modules don't work

I'm new with RPi and also Linux, so my question might be stupid but I tried to get Python 3.6 running with different ways (compiling, pyenv, berryconda). In general I think python is running on all ...
1
vote
1answer
416 views

Add Touch Mode feature to Minecraft Pi

I have Raspberry Pi 3 Model B+ with 5 inches Display with touchscreen for my challenge [Display works successful!]. I am using Debian Raspberry OS. I am on the file in /home/pi/mcpi/api/python/mcpi/...
1
vote
0answers
2k views

RTSP streaming works in VLC media player but not in Python OpenCV

I have Logitech C920 USB webcam connected to my rPi 4 4GB model. I want to stream the video feed through rtsp. The following command runs on the pi: cvlc -v v4l2:///dev/video0:chroma=mp2v --v4l2-width ...
0
votes
1answer
80 views

Controlling LED using PWM

When I run this code I’m expecting to get a led that brightens but I get a led that dims. import RPi.GPIO as GPIO import time GPIO.setmode(GPIO.BOARD) GPIO.setup(11,GPIO.OUT) dc=0 LED=GPIO.PWM(11,...
0
votes
1answer
24 views

Servo control issue

I have written a small program that controls two servos: to start the recording process one servo opens a shutter (servo1), then the second one lifts a sky camera out of a housing (servo2). To stop ...
0
votes
0answers
13 views

Calling pulseaudio: paplay - p record.wav from python script doesn't work

Objective: run a wav file from python on a Bluetooth headset paired to the raspberry Pi. So far my code works well when I run it on the raspberry pi in python. Once I call the same python script from ....
0
votes
1answer
66 views

Using Pymodbus, I want to tie coil states to GPIO pins within my server not from a client

I am writing a PyModbus asynchronous updating server based on the example on the Pymodbus Asynchronous Server Example and I want to link the states of the coils to GPIO pin states, such as when coil 1 ...
0
votes
0answers
43 views

PIP3: Install Offline & Update Older Library

Tried these commands to install an uncompressed package with pip3: pip3 install --no-index --find-links=/home/pi/Downloads/GitHub/cryptography cryptography sudo pip3 install -U --no-index --find-links=...
0
votes
1answer
36 views

Shutting down a LED when a script fails

I have a python3 script which is started by systemd automatically on boot. This script turns on a green LED to signal that the script has started. Now I want the LED to turn off if the script fails/...
0
votes
1answer
2k views

PWM object's ChangeDutyCycle method is not working

I have a motor class but I dont' know why this motor cannot change speed class Motor: def __init__(self, pos, line_status=0): def set_motor_gpio(_a, _b, _pwm): self._A = _a ...
1
vote
1answer
655 views

Raspberry pi interfacing with AD8232 using python

I have already seen the other post but I want a python code through with I can connect my raspberry pi and ECG sensor ad8232 I am totally new to raspberry pi interfacing so I don't completely ...
1
vote
2answers
133 views

Trying to debug why the magnetic sensor of my MPU9250/6500 Gyroscope Acceleration Magnetic Sensor won't connect via I2C but all the other sensors will

I am trying to debug why the magnetic sensor of my MPU9250/6500 9-Axis 9 DOF 16 Bit Gyroscope Acceleration Magnetic Sensor IIC/SPI won't connect to my Raspberry Pi 4+, but all the other sensors will. ...
0
votes
0answers
24 views

Raspberry Pi Python 3 Script - RuntimeError: Failed to add edge detection

I have looked at all the posts about this error, but none have cured it for me. I am using a ChronoDot RTC on an old Pi B+ with the SQW Wave Output going to Pin 8 which I use to update an LCD display ...

1
2 3 4 5
11