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
5
votes
1answer
1k views

Starting Browser from terminal and being able to control it via Python

I've got a Pi with a Adafruit TFT LCD installed. I'm using omxplayer and fbcp to stream videos at startup using python, like so: # Start Loop ct = 1 video_list = glob.glob('videos/*') os.system('...
5
votes
1answer
1k views

Raspberry Pi 2 and thermal printer

I try to print some text with python and a thermal receipt printer by a Raspberry Pi 2 model B. I use the library developped by Adafruit and the printer sold by Adafruit too. But it fails. The only ...
5
votes
5answers
49k views

pymodbus rtu RS-485 communication

I have this little device for communication, and I can see the dongle after lsusb, and it is attached to ttyUSB0 (output from dmesg). Since the module has its driver that is installed to Raspberry Pi, ...
5
votes
1answer
527 views

Camera access in docker container is generating errors / locking

I am trying to build some machine vision software inside docker containers, it has worked previously, but now both devices are not able to access the camera. It seems to be a configuration/update ...
5
votes
1answer
282 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 ...
5
votes
4answers
3k views

HC-SR04 randomly stops taking readings

I have implemented 3 HC-SR04 ultrasonic-distance sensors into my hobby-project, and they are working randomly, meaning they sometimes give me anywhere between 1-12 readings from the sensors and then ...
5
votes
1answer
393 views

What are the differences between these libraries? [closed]

Currently I don't know which library I should use OpenFace OpenBR OpenCV My system hast to recognize about 10 different persons and it will run on a Raspberry Pi 3 with the Raspberry Pi Camera ...
5
votes
2answers
8k views

Broken Python PIP install; What is the correct way to fix?

I have an install script that I've been using (and I swear it worked before on another Pi), but whatever I've done, it appears I have a broken install of pip, and I'm not sure how to fix it. I tried ...
5
votes
2answers
4k views

Crontab on Rpi not running Python script

I have a simple problem that I cannot seem to find an answer to even though I have done some research. I am trying to run a python script via crontab (I have never worked with crontab before this haha)...
5
votes
2answers
81k views

Reading from serial port [loop]

I would like to read from the USB serial port from time to time in a loop. I can open the port and read data with: import serial ser = serial.Serial('/dev/ttyACM0', 9600) while 1 : ser.readline(...
5
votes
2answers
4k views

Python Synth with Raspberry

I'm trying to create a synth using python with raspberry pi. I've written the code for manipulate the gpio input (i've modified the electronic of an old pianola and connected it to raspberry with the ...
5
votes
1answer
4k views

Zbar Installation

I'm attempting to install zbar on my raspberry pi. I built the source by entering: ./configure make make install I don't get any errors or warnings from any of the above commands. After the install ...
5
votes
2answers
992 views

Started picamera.start_preview() in Raspbian but don't see anything

I started picamera.start_preview() in Raspbian but I don't see the preview window which I thought was supposed to appear. import picamera cam = picamera.PiCamera() cam.start_preview() <picamera....
5
votes
1answer
9k views

Capture video for a certain time then quit and save to a folder using OpenCV 3

I am using this sample code from the OpenCV documentation and what the code is simply doing is capturing a video and when it's interrupted it saves it to a folder. What I want to do it capture the ...
5
votes
2answers
735 views

Pi Zero W not timing accurately?

Ok, I admit this a very odd issue I'm having. My setup is that I have an ultrasonic sensor that senses the distance every five seconds, and sends the data to another Pi, (a Pi 3 in this case) via ...
5
votes
5answers
2k views

Bluetooth buttons and mpg123

This is my first post. I have started a project with a rpi2 that currently allows me to bluetooth my rpi2 to a bluetooth speaker. On that bluetooth speaker there are three buttons. One that plays and ...
5
votes
1answer
3k views

motion detection and recording video with webcam

I want to record a video with a webcam when a PIR sensor detect motion, I have the picamera library installed, can any one help, thank you? import RPi.GPIO as GPIO import time import picamera import ...
5
votes
1answer
9k views

Resolution properties for python's OpenCV and uv4l camera driver

I've followed this tutorial to install OpenCV 2.3.1 in raspberry and it has worked fine. I've also installed from here the uv4l raspicam driver. But now I need to modify some capture properties as the ...
5
votes
0answers
3k views

How can I automatically deploy my code changes to my Raspberry Pi? [closed]

What is a good Continuous Integration / Continuous Deployment solution with Raspberry Pi? EDIT The developer experience with writing programs directly on the PI is suboptimal and potentially lossy,...
4
votes
6answers
7k views

How do I know what version of Python script I'm writing?

As a newbie to Python on the RPi (or anywhere else for that matter), how do I know what version of Python (2 or 3) I'm writing for without looking up every command or syntax while trying to write a ...
4
votes
4answers
2k views

Raspberry Pi stable date time

I'm working on a Raspberry Pi project, in which date and time are the most important factors. So, I want them to be very accurate. I know there are two methods to configure the Raspberry Pi's date ...
4
votes
3answers
5k views

Multiple GPIO Buttons vs Matrix Keypad

I've seen a tutorial here that shows me how to do this: But what I want to do is like this: I want to have multiple buttons and distinguish between them. The graphic I painted depicts the desired ...
4
votes
3answers
29k views

I changed my Raspberry Pi default keyboard settings. How can I reset this change?

I changed my Raspberry Pi keyboard (using command the sudo nano /etc/default/keyboardp). I set: XKBLAYOUT = 'in' Now, after reboot I just can't login! Can I somehow reset this CHANGE?
4
votes
4answers
1k views

Python script not running correctly when launched with crontab

I'm running a telegram bot on my Raspberry Pi 3. When I run it in my console or using Thonny, everything runs smoothly. python3 /home/pi/Documents/telegrambot.py The problem occurs when I set the ...
4
votes
2answers
177 views

Are there any major differences when programming of the Pi and for normal Linux

As the title says, are there any major differences in programming with Python on the RPi and a normal PC with linux? And if there are (excluding the GPIO and other platform specific stuff) could you ...
4
votes
3answers
53k views

PHP to execute Python scripts for GPIO

I found this code somewhere, that can execute Python scripts from PHP. I've installed apache2 on the Pi and I'm able to access the PHP script. But when I press the HTML buttons, nothing happens! :( ...
4
votes
2answers
13k views

Can't install lxml

I'm making a bot for a wiki I'm setting up, and for it I need requests and lxml. However, when I do pip install lxml it gives me: Command /usr/bin/python -c "import setuptools, tokenize;__file__='/...
4
votes
6answers
44k views

How to install python3-matplotlib on RasPi?

I hope there is a simple way to install python3-matplotlib package on my RasPi. My OS is raspbian. I've tried already: sudo pip3 install matplotlib (command gcc failed with exit status 1) also: ...
4
votes
3answers
8k views

Multiple Callbacks from GPIO interrupt

I created a quick program that uses the GPIO library to create an interrupt with a callback that is initiated when a (pink) button is pressed. It works, but when the button is pressed and then ...
4
votes
1answer
8k views

Why can't I turn on an LED through Python?

I have an LED connected to pin 11 on the Raspberry Pi header, (also known as BCM/GPIO pin 17, and GPIO0). I have installed the Raspberry Pi Python library according to these instructions. Attempt 1 ...
4
votes
4answers
4k views

Infrared NodeJS

I just orded my RPI a while ago (Haven't recieved it yet), and this is just completely out of curiosity, but will I be able to connect some sort of IR receiver, and get it's input in Node? Or is this ...
4
votes
2answers
2k views

How to set up dashboard for monitoring PI processes

I have PIs that use a schedule to play videos on loop. The PIs also use a daemon file 'surround.sh' to control the video player, and the daemon script allows the user to check the service status of ...
4
votes
4answers
5k views

Raspberry Pi camera doesn't work only displays red light

When I run my code, I get this error: No data received from sensor. Check all connections, including the Sunny one on the camera board The red light on the camera module glows, but doesn't ...
4
votes
3answers
10k views

GPIO.wait_for_edge on 2 channels at once?

So, I have 2 buttons set up on pins 17 and 27. buttons = (17, 27) GPIO.setup(buttons, GPIO.IN, pull_up_down=GPIO.PUD_UP) I need to accept input from EITHER of these for a set period of time. I ...
4
votes
1answer
22k views

Does Raspbian come with tk?

I'm considering writing a graphical front-end for low-end wearables (why should the wealthy have all the fun) featuring our prized Raspberry Pi. I know that TK is the standard for python, however I ...
4
votes
2answers
10k views

Upgrade from Python 2.7 to 3.3,x

How do I uninstall Python 2.7 and install the latest Python 3.3.x? Tried using "upgrade" but it didn't solve my problem.
4
votes
2answers
20k views

how do I enable JPEG support with PIL?

By default, PIL doesn't have jpeg support on the Raspberry Pi, so it returns the following: IOError: decoder jpeg not available This can also be seen while installing PIL: *** JPEG support not ...
4
votes
2answers
6k views

Getting feedback from a hall sensor with Raspberry Pi

This is my first Raspberry Pi project and I'm a Python newb. I've got a geared motor + driver + separate power supply (for the geared motor) + hall sensor. I know the "physics" and the way ...
4
votes
1answer
21k views

How to use a 4x4 keypad in Python?

I have a Keypad 4X4, but my actual code doesn't work. See below: import RPi.GPIO as GPIO import time GPIO.setmode(GPIO.BOARD) GPIO.setwarnings(False) MATRIX = [[1,2,3,'A'], [4,5,6,'B'], [...
4
votes
2answers
724 views

Building a Raspberry Pi network monitor. My code is not working

Long story short. I moved, put my home server is a closet and started worrying about temp and humidity, saw a guide online to make a network temperature and humidity monitor from a Raspberry Pi and an ...
4
votes
2answers
9k views

How do I wait for interrupts in different languages?

I have a IR photo gate sensor that I have attached to my Raspberry Pi, and it is working nicely as I test with WebIOPi and a C program using the wiringPi library. I would like to use some other ...
4
votes
1answer
10k views

Control seconds SPI interface with SpiDev

Is there any option to control the second SPI interface of Raspberry Pi 2 B with SpiDev? http://pinout.xyz/pinout/spi Pin 19, 21, 23 are SPI0 and Pin 35, 38, 40 are SPI1. SPI0 works perfect, but if ...
4
votes
2answers
16k 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 ...
4
votes
2answers
8k views

Resetting usb device from terminal

I am using a USB IR Toy v2 and using this excellent https://github.com/crleblanc/PyIrToy python library to get it working after failing to get things going with LIRC. However, while it works once, ...
4
votes
3answers
645 views

Start python script on pi through putty so it still runs after closing putty

I want to build a water dispanser using a raspberry pi. The pi is attached to a touch screen. Further, I made a python script to control everything. From time to time, I want to adjust the script to ...
4
votes
2answers
502 views

Python file called by PHP script in apache server unable to get RPi.GPIO

I've been trying to use a site on my local network to activate the GPIO pins on my Raspberry Pi 4. I installed apache and wrote a quick PHP script which executes a python file in /var/www/html.I have ...
4
votes
2answers
2k views

How to use Rpi python to control PCM1802 24-bit HiFi stereo ADC and MAX4466 microphone amplifier

I want to get Analog Audio Input using a PCM1802 ADC Module and MAX4466 microphone module using python. It is actually a project for a very basic and introductory course about Arduino and AVR assembly ...
4
votes
2answers
6k views

Selenium won't run on my raspberry pi 3 Model B+

Today I recieved my Raspberry pi 3 Model B+. I downloaded NOOBS and installed it on my raspberry pi. However, I cannot run a selenium browser on it. I have tried to install iceweasel but it says that ...
4
votes
2answers
10k views

Run python script at startup with Systemd service

I am having troubles running a python server script at startup on my RPi 3 B+. I created a python file and placed it in /home/pi/Desktop/scripts/bulb.py, it contains the python interpreter should be ...
4
votes
2answers
769 views

GUI with integrated Gnuplot

I am building a Raspbian app user-interface that displays two side-by-side data plots using the Gnuplot library. One way I could do this would go something like this: Create Gnuplots Export as PNG ...

1 2 3
4
5
58