Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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.

0
votes
0answers
6 views

Multiple GPIO.add_event_detect callbacks results in incorrect expected output

I am currently working with a differential drive robot which has two wheel encoders connected to GPIO Pins 5 and 23. I managed to obtain velocity information based on the pulse time information ...
0
votes
2answers
57 views

Writing to GPS HAT on Raspberry Pi Zero W Never Returns Anything

I have attached a GPS HAT to a Raspberry Pi Zero W running RASPBIAN STRETCH WITH DESKTOP. When I SSH in to run a simple Python script that writes to the HAT serial port, nothing happens and I am not ...
0
votes
2answers
296 views

Control Raspberry Pi to control an Arduino over Apache

I want to control a Raspberry pi to control an arduino which is controlled by a webpage hosted by apache. I do not know how I would attempt this and if it is even possible. Can anyone please guide me ...
0
votes
1answer
219 views

Keypad matrix 4x4 Python code error

Below is my code The code doesn't work because have this error: :NameError: name 'processKey' is not defined How do I fix this?
1
vote
1answer
227 views

ADXL345 Accelerometer attached to Raspberry Pi - Problems with Sample Rate

I have an ADXL345 Accelerometer attached via SPI pins to my Raspberry Pi. I use the following Python script to collect data: #!/usr/bin/python # -*- coding: utf-8 -*- import sys, math, os, spidev, ...
1
vote
1answer
255 views

prevent GUI notification for Bluetooth Pairing

Currently, I am trying to control Bluetooth (pairing - connecting - removing ...) with my python code (by accessing to bluetoothctl through pexpect). It actually works fine but I have a problem with ...
0
votes
0answers
14 views

Python PiCamera V2 won't take bmp images, why the errors?

from picamera import PiCamera import time camera = PiCamera() camera.resolution = (3280,2464) time.sleep(2) camera.capture("test1.bmp") # This code doesn't work #camera.capture("test1.jpg") # This ...
0
votes
1answer
223 views

serial errno 25 inappropriate ioctl for device

I have raspberry pi 3 B+ running latest raspbian-strech lite. i have a max485 ic connected to uart on the gpio. import serial,fcntl, struct ser = serial.Serial( port='/dev/serial0', ...
1
vote
1answer
2k views

Alsa lib error pyaudio on raspberry pi 3

I'm getting these ALSA lib errors when trying to use pyaudio. I know my mic works as I can live stream audio through gstreamer. Can anybody explain to me why i'm getting these issues: ALSA lib ...
0
votes
1answer
232 views

How to keep script running even after session timeout

I have a python script I want to keep running for most of a day. I have tried the following; -- Screen. I SSH to the Raspberry Pi,and they type "screen bash", I then start my script and then "control-...
1
vote
1answer
297 views

Python's raw_input() function causes problems in systemctl service

I am attempting to create a safe reset switch according to these instructions. I have implemented the interrupt-based solution (listing 1) which runs fine if I start the script from the command line, ...
1
vote
2answers
33 views

I'm trying to run a python script at boot but keep getting “socket.error: [Errno 111] Connection refused” error

I've bought my first Raspberry Pi 3B+ last week and started working on my project but I seem to be stuck at this point. I've looked through a hundred different posts but none of the solutions seem to ...
0
votes
1answer
27 views

interface bmc280 & tsl2561 together [closed]

I am trying to interface bmc280 & tsl2561 together with Pi Zero. I have connected bmc280 to Pi Zero on Pin 3-I2C.1 SDA & Pin 5-I2C.1 SCL and was able to read the data over i2c. Also want to ...
0
votes
0answers
260 views

Configuring paho-mqtt

Hello i would like to configure paho mqtt but i am having trouble to get it to work properly. I am quite a beginner and i have been following this tutorial. This is an easy tutorial and i have ...
0
votes
1answer
228 views

NameError:Function not defined

I have a class RelayChannel and I want to call the function RelayChannelOn() to this code but I get error : NameError: name 'RelayChannelOn' is not defined. Here is the code where am calling the ...
0
votes
1answer
278 views

Running openCV C++ file from python in Raspberrypi

I'm creating a object and color detection robot. Here in this case, I'm using C++ to run the camera and process the image with openCV in C++, but before I run the Camera, I want the robot to move and ...
1
vote
1answer
255 views

Raspberry pi freezes after 20 minutes of use

using tkinter i have made a GUI in which a video plays continuously in a loop until the ultrasonic sensor detects a person in front of it. when a person is detected it displays a messages"hi..welcome"....
-3
votes
0answers
22 views

Code for stepper motor 28BYJ-48 to work with a pibrella

I have already attached the wires to the outputs (Red - E+, Orange - E-, yellow - F-, pink - G-, Blue - H-) but am not sure how to program it.
0
votes
3answers
286 views

OpenCV 4 error?

When I run the command python faceDetection.py I get the error- VIDEOIO ERROR: V4L: can't open camera by index 0 Traceback (most recent call last): File "faceDetection.py", line 21, in <module&...
0
votes
2answers
245 views

PIR Module False Positivesq

All I am working with a PIR Module and a camera for a project to provide text messaging when motion is detected as well as taking a picture. I am seeing a large number of false positives from the PIR. ...
1
vote
1answer
2k views

Issues with Kivy on Raspberry Pi 3 with 3.5 in Touchscreen

I followed every guide I could find on installing Kivy to Raspberry Pi. My touchscreen works totally fine. Trying to launch various Kivy demos will result in what seems to be a partial launch, but ...
3
votes
2answers
314 views

Occasionally get “Register read error: 0xee06” when script is run with Adafruit BNO055

I'm running scripts on a Raspberry Pi 3 hooked up to an Adafruit BNO055 sensor, and occasionally when I run the test script I get this error: Traceback (most recent call last): File "...
0
votes
0answers
13 views

lxml package freezing during install

I'm trying to install the pyquery module, which requires lxml. Whenever I try to install the lxml module, though, it gets exactly this far: $ sudo python3.7 -m pip install lxml Looking in indexes: ...
0
votes
1answer
265 views

Setting up the Raspberry Pi as a client on a sever

I'm attempting to give my Raspberry Pi a static IP address on an ethernet network that I am controlling from a Windows machine. I want to be able to send my PI UDP packets directly from my server via ...
1
vote
3answers
35 views

can't install opencv on my pi

I'm an absolute Raspberry Pi newbie. My intention is to get some camera vision project working for which I need OpenCV3.3's dnn Python module. I've found here a description of how OpenCV can be ...
1
vote
3answers
246 views

How to display gpsd.utc using paint or similar method

I am receiving reliable gps data from my Adafruit gps sensor. I would like to to show the gpsd.utc data across the screen so that it appears like a regular clock. I have the following code which shows ...
3
votes
2answers
7k views

Can't install Flask-Bcrypt: `libffi` is missing

I try to install Flask-Bcrypt on Raspbian to hash passwords in my Flask application, but I get this error: Searching for flask-bcrypt Best match: Flask-Bcrypt 0.7.1 Flask-Bcrypt 0.7.1 is already the ...
1
vote
1answer
598 views

smbus/I2C sensor returns fixed data

I am attempting to use a sensor in conjunction with a raspberry pi smbus. When I try and read a specific byte of data, it returns 181. No matter what byte you tell it to read it returns 181, ...
0
votes
2answers
40 views

Python button script stopped working

I have this script which runs a motor until a button is released. It was working fine up until making some changes to the setup earlier but now the motor doesn't stop when the button is released - ...
1
vote
0answers
21 views

Programming bluetooth module of RPi 3 B

I'm trying to scan the invironment of the Pi for active bluetooth devices. I'd like to have MACs, names and signal strength. Of course I can run bluetoothctl in the shell and then use scan on command ...
0
votes
2answers
1k views

Simple LED code says that object has no attribute output?

I installed RPi.GPIO .5.1 and my uber basic led code says that the object has no attribute 'output'. I am hooking up the 12 pin to the Breadboard and I have ground hooked up too. Here is my python 2....
0
votes
1answer
49 views

On boot open tmux session and start continuous python script

I've spent days going in circles with this one, my google skills have failed me... I am using a systemd service to run a shell script on boot which should open a new tmux session and start a python ...
2
votes
1answer
289 views

USB audio from Pygame

I am running Raspbian Stretch. I've connected a USB sound device and selected it through the graphic interface. This sends the sound out fine from youtube in Chrome but is silent with a Python ...
3
votes
1answer
271 views

Is it possible to connect a Minecraft Pi Edition Python script to a specific active game window?

Is it possible to connect a Minecraft Python script to a specific active game window when multiple game windows are currently open? For example, I have three different open games on one Raspberry Pi ...
1
vote
1answer
300 views

Bluetoothctl connect TIMEOUT exception

This is the error I am getting when I connect to my mobile phone using the connect method in this documentation: https://gist.github.com/egorf/66d88056a9d703928f93, raise TIMEOUT(msg) pexpect....
0
votes
2answers
32 views

how to remotely control raspberry pi gpio

I'm doing a face recognition project that uses opencv and python to recognize a person's face on a pc. Now, my goal is to use a raspberry pi to access one of my gpio ports, and when One face was ...
0
votes
1answer
40 views

Terminal and program run on boot-up

I am trying to find a way to open a terminal and run a program on boot using Raspberry Pi's newest Raspbian Jessie. I have tried to use the following: /home/pi/.config/autostart/whatever.desktop [...
0
votes
1answer
716 views

Wiegand GPIO read not working all the time. Works most times but hangs on some reads

I'm extremely new to Python, I've been learning a bit over the last couple weeks. This is what I've managed to come up with. I'm pretty over the moon the code works most of the time but it doesnt work ...
1
vote
1answer
32 views

JSON not working with LIRC

I have the following script which is meant to write/read a json file. The problem is it will only write/read the file from the command line and not when using a remote via LIRC. import RPi.GPIO as ...
0
votes
1answer
1k views

How to use E18-D50NK on a Raspberry Pi?

I have one question . I want to try out a sensor called E18-D50NK, which is a infrared proximity sensor, for obstacle avoidance. More details and information about this sensor can be found here : ...
0
votes
1answer
2k views

Reading registers through pymodbus

I have been trying to use pymodbus to read registers from a power meter and searching around here I found a useful code from the question I attach in the end of this post. So I wrote/copied the next ...
0
votes
2answers
566 views

Python MCP23017 16 ch. I2C input loosing a bit

I bought a MCP23017 and doing some small test with it. I've made a simple Python script to make read_out of pin state. Can anyove explain to me, why i'm loosing a bit when GPIO_A7 is triggered? I've ...
0
votes
1answer
61 views

trying to run 6 USB cameras simultaneously on a single Raspberry Pi 3B+ with add-on 4 port USB hub with external power

We are trying to simultaneously run 6 cameras on a Raspberry Pi 3B+ with an add-on 4 port USB hub that has an external power supply. The cameras are set at 15 FPS with a colour image size of 640 X 480....
0
votes
0answers
43 views

Raspberry Pi jammed after few days of continuous work? size full?

I made a project on raspberry pi 3+ and left it on over a weekend. After 4 days, when I came back, the program was not working. When I try to connect it with Remote Desktop, it was not working. I ...
0
votes
2answers
39 views

How do I write data to a file, and not just print to console window [closed]

I'm trying to write this print dt(), socket.gethostname(), " at ", getIP('eth0') print "---------------------------------------------------------" print "Temperature: ", CPU_temp,"F" print "CPU ...
0
votes
1answer
450 views

Sense Hat RGB Code

I am a new programmer, trying to learn python. I am using the sense hat to mess around with, I want to make it like rotate RGB colors. I am using the sense.set_pixel and passing in the x,y and r,g,b ...
0
votes
1answer
59 views

prevent script running twice consecutively - Python

I have the following two Python scripts one sends a motor forward while the other script sends it backwards. Each script is operated by it's own button on a remote. Script A import RPi.GPIO as GPIO ...
1
vote
1answer
377 views

Error when installing Flexget

Having some problems trying to install flexget. I get the following error when I run the command: pi@rpi:~$ sudo pip install flexget Requirement already satisfied (use --upgrade to upgrade): ...
0
votes
2answers
320 views

Trying to interface with the serial port with a simple program

Hey I am trying to work with the serial port of my raspberry pi model 2B with a raspbian jesse OS. I have disabled the serial login shell over serial in the advanced options. I have enabled uart in ...
0
votes
2answers
702 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 ...