Quantcast
Channel: Raspberry Pi Forums
Browsing all 1225 articles
Browse latest View live

Python • BME280, convert temp C to F

One last question I have is how to convert the Celsius temp in the BME280Code: from machine import I2Cimport time# BME280 default address.BME280_I2CADDR = 0x76# Operating ModesBME280_OSAMPLE_1 =...

View Article


Python • Re: BME280, convert temp C to F

It looks like you are trying to modify the code in the library module .... DON'T. You're changes will be lost in updates. Plus it is not good practice unless the creator has told you how to overload...

View Article


Python • Re: Unable to import cv2 on OpenCV installation

Sorry about the delay. I've been working hard on my end trying to figure out what the problem is. I have installed virtualenv but when I callCode: python -m venv envit returns errorCode:...

View Article

Python • How to add seperate legends to the graph

Hi all, I am plotting a graph of three sub-plots. I am trying to add axis labels to these sub-plots. But I don't know how to add different axis labels to corresponding sub-plots. I want to add...

View Article

Python • Re: How to add seperate legends to the graph

a1 = fig.add_subplot(311, ylabel="AAAA", xlabel="BBBB")a2= fig.add_subplot(312, ylabel="CCCC", xlabel="DDDD")a3= fig.add_subplot(313, ylabel="EEEE", xlabel="FFFF")Axes label shown for y-axis, but the...

View Article


Python • Help with MQTT restart code

Morning All,For a while I've been using a Pi Zero W with a python script, sensors and relays to run my heating system, in combination with Home Assistant (HA). HA runs the thermostats, GUI etc. and...

View Article

Python • Re: Help with MQTT restart code

Test mqttclient.isconnected() and if it's negative go through a connect() process. I'm sorry I don't have an example, most of my Mosquitto code acts as a client using connect, subscribe, get message,...

View Article

Python • Re: W1Thermsensor Questions

However, I found myself struggling to setup a v-env in Bookworm, but I'm trying to figure that out.My suggestion is that if you developed your project without VENV then disable VENV globally for your...

View Article


Python • Re: Trying two alternate 2 motors with one switch

I have tried code example you posted I get error?py", line 55 finally:IndentationError: expected an indented block after 'finally' statement on line 55That code came from your other helper,...

View Article


Python • Problems in the venv environment

I'm getting this error message after installing gpio, lgpio, and RPi.GPIOI first installed the gpio package, but that gave me a lot of error messages while typing in the python promptCode: red =...

View Article

Python • Re: Problems in the venv environment

I'm getting this error message after installing gpio, lgpio, and RPi.GPIOI first installed the gpio package, but that gave me a lot of error messages while typing in the python promptCode: red =...

View Article

Python • Re: Zero 2 W vs Zero W

It's evolving, but not in a good way for the Zero's, The Buster desktop will not run either Chrome or Firefox in 64 bit, it seems to run out of memory, and seems to be in an endless swap cycle with...

View Article

Python • Re: Activating a venv at boot time

I think you should change the way you've scripted your bash fileCode: . <venvname>/bin/activateThe above line works for me, provided you put the name of the venv where the <venvname> isTo...

View Article


Python • Web Scraper

I am interested in consolidating data from several websites onto a spreadsheet that I can sort and rank. This data is intended for my personal use only. I have looked at a couple tutorials and begun...

View Article

Python • Re: Web Scraper

I had a python scraper running on a pi zero.I used lxml.It took traffic information from the BBC and via LED's and a screen told my wife about issues on her work journey. I scraped every 5 minutes for...

View Article


Python • Upload Code

Hello,I want to run a Python script or file on Raspberry Pi when booting. Is it possible without sudo nano /etc/rc.local , just by writing the script on PC and uploading it to Raspberry Pi? How could...

View Article

Python • Re: Upload Code

You could write code on a pc and put it on your Raspberry Pi, you will have to enable filesharing first, but you won't be able to test it on a pc, and it seems a bit of a palaver to go through that...

View Article


Python • Re: Problems in the venv environment

Is there any naming conventions I have to avoid, or folder conventions I have to follow?Seems like every time I create a venv, my venv environment gets messed up and won't run python scripts (it does...

View Article

Python • NRF24L01 Pi to Pi communication

I'm using a modified version of the slave and master file from this tutorial: https://thezanshow.com/electronics-tuto ... rial-32-33 I am trying to modify the master file so that I can use take user...

View Article

Python • Re: NRF24L01 Pi to Pi communication

Not tested: should be possible to send strings. Or list of integers.Code: message = "hello" radio.write(message)https://github.com/BLavery/lib_nrf24/bl ... 24.py#L248Statistics: Posted by ghp — Mon...

View Article
Browsing all 1225 articles
Browse latest View live