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
387 views

Lego EV3 infrared sensor to raspberry pi 3 direct connection via UART?

I connected this sensor with raspberry via UART( I have found that this IR sensor is one of few Lego sensors that connects via UART), and make serial_read and serial_write python scripts, just to test ...
0
votes
0answers
20 views

No available Audio Device after switch from NOOBS to Raspbian Stretch

my program uses Pygame to play sounds. I used Noobs before and my program worked fine in Thonny. Now, i switched to Raspbian Full Stretch and now I get the error No available Audio Device. I already ...
1
vote
4answers
47 views

Pi - own python startup script in the wrong order

I've written a python script to connect to mysql & insert the current time then close. The use case is if my Pi browns out/restarts (often does) the time of this event will be logged. The script ...
4
votes
2answers
15k views

How to trigger GPIO event using an active infrared sensor

Trying to get an active infrared sensor to trigger an event on a GPIO pin. I'm using python and the RPi.GPIO library on an RPi model B. Some background info, not sure how relevant it is, but I'm a ...
1
vote
2answers
275 views

Runtime error A PWM object already exists for this GPIO channel

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
93 views

Error With Taking Time Lapse Photos

I'm trying to take a time lapse using my pi camera but whenever I try and run the code using python the following error pops up: mmal: mmal_vc_component_create: failed to create component 'vc.ril....
0
votes
1answer
180 views

error trying to set up RFIDIOT on raspberry

I am new to raspberry and python in general. I followed different guides to set up RFIDIOT (even the documentation and the installation guide on the repository on Github). So far, when I run pcsc_scan ...
0
votes
0answers
16 views

Which screen size in Pygame for an 3.5 inch LCD?

i try to fill out my whole LCD screen in Pygame with the best sharp resolution possible. So there is a difference between computer screen and the LCD. My LCD has resolution is 480×320. So choosing ...
0
votes
0answers
21 views

Need help on how to apply arcade kit commands in Python code

I'm using Python on my Raspberry Pi to code some games for my high school finals project, and I want to play them with a arcade kit (Game DIY Arcade Set Kits Replacement Parts USB Encoder to PC ...
1
vote
1answer
187 views

Why is PIR motion Sensor always on?

I'm trying to make an alarm system but the motion sensor is always on as soon as the script is run. I've posted a question about a different problem i was having with this project so it'll confusing ...
0
votes
1answer
109 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
97 views

GPIO button to complete input prompt

I would like to prompt the user for input, then with the push of a GPIO button, submit the input value. This is tricky since the GPIO button polling is typically done in a loop. I was thinking that ...
1
vote
1answer
82 views

How to toggle button on and off with gpiozero?

I can't seem to find a solution of doing this using gpiozero. I've done it using rpi.gpio with add_event_detect and call back to change state but I was under the impression gpiozero is much simpler. ...
2
votes
1answer
54 views

Raspberry pi 3 RFID RC522 Card UID is not same with USB RFID Reader

I'm working with RFID RC522 using Raspberrypi 3B+. I'm following https://github.com/mxgxw/MFRC522-python this package and works like a charm. I can able to read the data from the card, able to write ...
0
votes
2answers
424 views

PyQt5 not found by Python3.7

I installed Python 3.7 on my raspberry pi with the help of Installing Python 3.7.0 on Raspbian tutorial and wanted to use it to start my script which uses PyQt5 but its throwing a ModuleNotFoundError. ...
0
votes
1answer
156 views

time.strftime working on windows but not on raspberry pi

I am working on a project that requires pyqtgraph library of python on raspberry pi. It functions well until I added a system time axis on my graphs. What also weird is that the script I am using ...
0
votes
0answers
39 views

Cant upgrade Raspbian neither run Python

I am trying to upgrade my Raspberry Pi 3 B+: $ uname -a Linux plexmediaserver-pi 4.14.98-v7+ #1200 SMP Tue Feb 12 20:27:48 GMT 2019 armv7l GNU/Linux But I am getting this weird error: pi@...
0
votes
1answer
111 views

Rasberry Pi LED GPIO using Python

In my project I invoke a python script via node.js on my Rapberrypi B+ model and what the python script does is that it turns on the BCM GPIO ports as per the python arguments passed through the ...
0
votes
1answer
116 views

generated pulse with delay time before it generated

I want to generate about 16 square wave with delay time initial as the following figure .It mean each pulse generated must delay with a value of delay time before it generated with frequency about ...
0
votes
1answer
282 views

Voltage High, low with 0 and 1 using python on a GPIO

Mind the variable creations as they are handled. My questions are the following. 1) Why do we have 2 whiles here? Does the sleep at the end of the first part does really anything significant? 2) ...
0
votes
2answers
132 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
3answers
974 views

Why can't I connect to my Raspberry Pi through SSH on my PC or a phone app?

I tried to SSH into my Pi using PuTTY, but I got an error: Network Error: Connection timed out I have checked my router, noted that the device is indeed connected to the network, I was able to use ...
0
votes
3answers
46 views

Use a bash file to open a lxterminal and run commands into it automatically

I have made a python application for raspberry and it needs to run into a terminal. That's totally necessary. To do that I wrote two bash files, run_.sh and launcher.sh. run_.sh execute the python ...
1
vote
1answer
216 views

GPIO Input Not Detected Within While Loop

Hi I'm having a problem with trying to detect GPIO input on a PIN within a while loop. Turnstile B Entry button is what I am troubleshooting the statement if tsB_entry_button == False: import RPi....
1
vote
4answers
60 views

How do I fix incorrect timestamps in my bash script that launches on startup?

I'll try to explain this the best that I can. I am creating a simple bash script that runs on startup. This script is supposed to create an archive based on the current date, run a python program that ...
2
votes
1answer
62 views

outb() equivalent in Python for GPIO

I am a very beginner on programming and raspberry usage, tho I think I learn fast. I am trying to convert an old program (not mine) that was written for Linux on C++ for communication with a printer ...
0
votes
1answer
29 views

Wireless doorbell using gpiod

Good Morning, I have a non issue that I am just curious how its working. So I have a wireless doorbell that I built. It works using the gpiod and remote gpio. So I have a chime unit that I built with ...
-1
votes
1answer
160 views

Adafruit's LCD doesn't show text

I've just written small python script to operate adafruit's lcd with additional module. Almost every lcd's operation is handled by module. But when I try to print a message on screen or in console, ...
1
vote
1answer
138 views

Start pi_video_looper from Python

I am new to Python so please be kind ;) I am trying to start the Adafruit Video Looper from a python script. Basically I have this code: from pi_video_looper.Adafruit_Video_Looper.video_looper ...
0
votes
3answers
229 views

VNC: how to manage a fleet of RPi?

I've to manage 50 Raspberry Pis remotely, e.g. via VNC over the web. The RPis are behind a router, so I can't access them by IP. I'm looking for something like a self-hosted TeamViewer. The desired ...
-1
votes
2answers
505 views

How to run a python program from a bash script on startup?

I have a python script that is located at /etc/testscripts/WebServer. I call this usually from the command line by calling sudo python3.6 /etc/testscripts/WebServer. I have a bash script that looks ...
1
vote
1answer
170 views

Python Code for Home Automation times out

I was making a python script for home automation using Adafruit IO as a conduit between IFTTT and the Raspi, and it works great for a while. But after a few hours, it just stops working. I have no ...
1
vote
0answers
30 views

Develop a communicattion between a Raspberry with BLE server and a Raspberry with BLE client

I have been developing an small project which requieres a communication between two Raspberries, the first one acts as a Beacon and the second one tries to connect to that beacon and obtain the RSSI ...
0
votes
1answer
48 views

128x64 OLED Display Issue [closed]

I have a cheap display I got from eBay connected to a Raspberry Pi B+. It has 4 pins (vcc, gnd, scl, sda). I followed the adafruit tutorial here but after setup, when I run a python example (any of ...
1
vote
0answers
36 views

PiCamera vs VideoCapture

So I have a project that requires Computer Vision (video stream). But when I want to try my Pi Camera (not USB), there's two method that I can use. They are PiCamera.capture_continuous and cv2....
0
votes
0answers
31 views

Can't send UDP packets

I am trying to send a 4-digit number, that is a result of two HC-SR04 sensors'measured distance, through UDP and according to almost every command and wireshark on my computer, the Raspberry isn't ...
1
vote
0answers
13 views

Launch a python script in a lxterminal window using supervisord

I'm trying to launch a python script in a lxterminal window using supervisord. I'm stuck on using supervisord than a .desktop file. I'd like to keep the process running on loop Below is my config: [...
-1
votes
1answer
44 views

Creating a Day Counter

Does any one know the best way for me to make my PI count the days since an action was performed and display the value every day, I basically want my pi display to tell me how many days have passed ...
0
votes
1answer
125 views

Run a python script when start up and SSH not log in

I am new to programming and doing a simple academic project with Raspberry Pi, I have a script which will monitor the changes of database and output the change with 2 different color LED. I want it ...
2
votes
3answers
385 views

Connecting multiple load cells Pi Zero W to read individual values

I have a project in mind where I want to measure the weight and position of an item on a shelf. The idea was to mount the shelf on a load cell in each end and then get the weight and ratio between ...
2
votes
2answers
5k views

Problems installing lxml

I'm trying to install lxml (I need version 3.3.4) but when I try to pip install --upgrade lxml I keep getting build errors: gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-...
0
votes
1answer
215 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/...
0
votes
1answer
202 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 ...
4
votes
1answer
263 views

How to make sense of this Raspberry Pi project guide for building a theremin?

I have just started out using a Raspberry Pi, and for my first project, I wanted to build a pseudo theremin using an ultrasonic motion detector and other electronic components (requirements are laid ...
0
votes
0answers
17 views

How to send data across usb0 to use in pygame?

So i have a pi3b+ and a zero hooked up to a tft ili9341 display. I can run pygame on boot and it works fine. I have also started using python sockets and successfully sent data (my wlan0 ip) from my ...
0
votes
2answers
2k views

Raspberry Streaming using VLC picamera python

I am trying to stream Raspberry Pi camera video using VLC. The code is as follows: import subprocess import picamera camera = picamera.PiCamera() camera.resolution = (640,480) cmdline = ['cvlc','-vvv'...
0
votes
1answer
239 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
30 views

L298N H-Bridge motor control code issue

I am learning how to build a basic robot using a raspberry pi and an L298N h-bridge. I have followed this tutorial successfully i:e the single DC motor I have connected does work in response to the ...
1
vote
1answer
221 views

reverse-geocoder on Raspberry Pi

In a project I am currently working on, I use Python to display my current location, speed, etc. I now wanted to implement the reverse_geocoder library (https://github.com/thampiman/reverse-geocoder) ...
1
vote
1answer
69 views

Why is SPI not working on any of my Raspis?

I tried it on both Raspi 3 and 2 using the SpiDev python library. I've never even seen any kind of output on MOSI or CS lines with my oscilloscope. Controlling an SH1106 OLED display via the luma....