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
3
votes
2answers
258 views

How to connect ST7789 LCD to SPI Bus 1 as 2nd screen?

I've been trying to get this ST7789 library working with the 240x240 1.3" display on the rpi0w Python lib https://github.com/solinnovay/Python_ST7789 So far I've set all the screen pins to the bcm ...
0
votes
1answer
616 views

Using gpio from CLI to trigger a rising or falling event detection

I have a python system script with various functions. I have multiple buttons hooked up to the Pi and I am using this code: import RPi.GPIO as GPIO GPIO.setmode(GPIO.BCM) GPIO.setup(22, GPIO.IN, ...
2
votes
3answers
93 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 ...
1
vote
1answer
2k views

RFID RC522 Reader & Chromium Web Page

I'm having a bit of difficulty locating a specific example, however I have found people referencing that they have accomplished what I am looking for. At a basic level, I have a webpage being served ...
1
vote
1answer
4k views

Error trying to install python-firebase on Raspberry Pi 3

I have installed requests but I'm unable to install the python-firebase package. I want to fetch data from firebase on my Raspberry Pi 3. I have used the following code to do the same on my PC. from ...
1
vote
2answers
1k views

Raspberry pi 3 reading serial port

I have a python code that reads the serial port of the raspberry pi 3to obtain GPS positions from a fona808. The code works for some time and then throws this error. Traceback (most recent call last):...
1
vote
2answers
837 views

How can Rpi move a servo motor using a GPIO pin in PWM mode?

iam new to raspberry pi and i got an error while a running servo motor in my object detection script i need to run the servo whenever my if condition is true so the same pin run multiple times if ...
0
votes
1answer
39 views

SimpleMFRC522 stop reading after some time

My code stack after some time (example 1 day) after reading MFRC522 in loop mode. At the beginning it works without problems, after some time is not working anymore. I can't figure out why. Can you ...
1
vote
2answers
49 views

Remote write to file via ssh

I have 2 raspberry, and I want to have python script on pi1 that will open file and write something into it. That works on pi1. But when i try to run script from pi2 via ssh, it wont write to file. ...
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
558 views

Understanding struct.unpack code

Hello great community of helpers! We new programmers greatly appreciate your continuous help. Thank You! Can you explain this 1 line of code below... - Or break it down into separate chunks. I ...
0
votes
0answers
103 views

Raspberry Pi IR camera light sensor access

I am trying to use the light sensors on the the raspberry pi IR camera as a light sensor to determine if light is exposed or not. Is there a python picamera command that could access these light ...
1
vote
3answers
792 views

Crontab task not running script - Permissions?

I've got a python script on my Pi 3 to read a value from an ultra-sonic sensor then write to a db - that alls grand. I've tried to make a crontab task scheduler for it, but it's not working. First, ...
0
votes
1answer
37 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
17 views

User right problem while python script and git during boot up

I'm running a Raspberry that executes on the startup from the rc.local the following command: sudo /usr/bin/python3 /home/pi/skript.py >> log.txt 2>&1 & I need the sudo rights ...
1
vote
1answer
18 views

OpenGL 2 slowness

The Raspberry Pi 3b+ runs my OpenGL 2.1 program very slowly, with a frame rate of around 2 fps. How is this possible, when Python/Pyglet can render (using OpenGL, I suppose) much faster than this? And ...
0
votes
1answer
691 views

ultrasonic sensor stops after giving some reading when running in thread on tornado websocket python

I am using Ultrasonic sensor to get reading and am using python program for getting reading. And am using Raspberry pi for this. when am running python program independently its giving me reading ...
0
votes
2answers
2k views

Kivy won't listen to “fulllscreen” setting

Working on a Raspberry Pi Model 3 B, running raspbian. Running Kivy v1.9.2-dev0 and Python v2.7.3 Trying out one of the Kivy examples but for some reason the application won't come up in "Windowed ...
0
votes
1answer
23 views

Idle 3.6 fails to install

I'm trying to install IDLE however I get this error message - $ sudo apt-get install idle-python3.6 Reading package lists... Done Building dependency tree Reading state information... Done ...
0
votes
1answer
79 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
5answers
2k views

from pubnub import Pubsub ImportError: cannot import name Pubnub

This might be a possible duplicate, but I wasn't able to find a solution in the link here. I am new to raspberry Pi I wish to use Pubnub to communicate with an android application and a Raspberry Pi. ...
1
vote
0answers
13 views

Is it possible to run django app on raspberry pi 0 w

As per above, considering no calculations are done on the app side, and it just displays templates with some javascript, would it work on Pi0w? Is it safe to assume that as long as it is capable of ...
1
vote
1answer
1k views

Problem with GPS module and Python

I copied a program from the Adafruit webpage to test my GPS module and before running it I installed the Python gps with sudo apt-get install python-gps but when I run the program I get this error: ...
0
votes
1answer
503 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 ...
1
vote
1answer
529 views

sudo pip install packagename not working

sudo pip install packagename not working... I am not able to install python package using pip.
0
votes
1answer
865 views

How can I turn on/off LED of RPi.GPIO in the same number key?

I am trying to write the following program (8Relay.py) using python on the Raspberry Pi. I want to use the input from a GPIO pin to turn an LED on or off, depending on what input was pressed (1~8). ...
1
vote
1answer
25 views

How can you use pigpio's set_servo_pulsewidth with an i2c address?

I've tried to use hexadecimal for the GPIO address to see if it would work with GPA0 on the MCP23017 import pigpio import time pi = pigpio.pi() gpio_num = 0x21 while True: pi....
0
votes
1answer
177 views

Camera feed sent through TCP socket gets stuck sometimes

I am getting the camera feed from a camera on a Raspberry PI to the computer using a TCP socket to use it for openCV. It works well with minimal delay. However, sometimes the frame gets stuck(freeze) ...
0
votes
1answer
46 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 ...
0
votes
1answer
2k 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 ...
1
vote
0answers
14 views

Python script to search and get files from NAS [closed]

I am trying to use my RaspberryPi as a photoviewer, using the thousands of photo's from my NAS. I've build python scripts to show a random selection of the photo's. The NAS is not allways up, so my ...
0
votes
1answer
822 views

Audio Processing Issues in PyAudio in RPi

Basically, I want to analyse the spectrum of the input audio stream to my Raspberry Pi. I have configured my Audio USB Adapter and ran sample tests on Play and Record. I am using PyAudio to take ...
3
votes
0answers
69 views

Problem sending analog read values over serial

Ok I apologize as I have edited this quite a bit, but I have narrowed down the problem a bit more. For some reason I can't transfer values from my arduino analog pins?? I am trying to send values ...
0
votes
2answers
50 views

Adding Averages to my Data Logger

I am using this Python program to log data from a serial device, and want to add a second document that logs hourly averages of the data. Anyone have an idea on how to add hourly averages? #!/usr/bin/...
2
votes
2answers
917 views

How to send and read a string from Raspberry pi to Arduino via serial interface?

I was trying to send and receive data between Raspberry pi and Arduino UNO. I'm able to send and receive a string from Arduino to Pi using Serial.println. I spent hours searching a better tutorial or ...
1
vote
3answers
271 views

Bridge between Web&GPIO

For an alarm clock I am trying to have the interface in HTML and CSS and I need the GPIO pins for PWM-output (3 channels and some digital, possibly also "analog" inputs). I want a neat web-interface, ...
0
votes
1answer
138 views

Error executing ifdown and ifup command

I'm running a python script to configure the wifi interface, but I'm having a problem with the ifdown and ifup command. It looks like this command has been replaced by: sudo ip link set wlan0 down ...
3
votes
1answer
5k views

Having trouble sending audio data over TCP using Sockets to raspberry pi

I am trying to do something like a walkie talkie. 1 device is my laptop and the other being the raspberry pi. What I have working. I am able to record the microphone, transmit it over a socket and ...
1
vote
1answer
355 views

Access GPIO pins through a Flask + Apache/mod_wsgi

I get an internal server error when I import the gpio pins library in my simple __init__.py file. And the debugger doesn't show up. As I understand it, the server doesn't have the permission to ...
3
votes
4answers
412 views

Raspberry Pi run commands on boot

I thought that running commands on raspberry pi on boot was the easiest thing in my project. But it seems that it is complex enough not to work. I've searched a lot on the internet on a simple ...
3
votes
2answers
346 views

Excute python file on start-up

I have a simple python file(no GUI) that I'd like it to run in the background at start-up of raspberry pi 3b. I checked out this post Execute script on start-up But it didn't specify what to do with ...
0
votes
2answers
86 views

How to make a service to run a python script which includes browser automation

I have python script which is using selenium web driver to do some web automation task. This python code is running perfectly fine when I am running it from the terminal. It launches firefox and does ...
0
votes
1answer
24 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
2answers
98 views

I2C MPU9250 Gyro/Accelero/Magneto 9-DOF Sensor MicroPython Programming Problem

so I've recently set up my raspberry pi. Am following a tutorial for the MPU9250, from https://github.com/tuupola/micropython-mpu9250. I have did a install of the micropython-mpu9250, and tried the ...
0
votes
1answer
6k views

Interfacing raspberry pi 3 with load cell using hx711

I am trying to interface a weight sensor with my raspberry pi 3 model b. Issue: I keep getting 0 readings no matter how much force i apply. Equipments: -raspberry pi 3 -HX711: https://i.stack.imgur....
1
vote
2answers
21 views

Rpi zero w serial code python

So i set up my rpi zero w to comunicate at 11500 serial with an arduino... the arduino sends over serial lines such as "~1 11443". My idea is that the ~ character tells the pi when to look for data, ...
0
votes
1answer
38 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
1answer
45 views

Problem running the serial module with Python

I am trying to use the serial port on the Raspberry but when I run the example below I have the message: TypeError: 'module' object is not callable import time import serial ser = serial.serial( ...
0
votes
1answer
90 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
28 views

Error when creating Python GUI using Tkinter: “no display name and no $DISPLAY environment variable”

last few days I've been working to create a GUI using Tkinter This morning my code still worked, but now it crashed with said error: Traceback (most recent call last): File "TKtest.py", line 3, in &...