Comments (3)
this is not an issue related to the content of this repo. however, I can suggest you to read about the sysfs. there's a subsystem called thermal
in /sys/class/
that should contain one or more thermal_zone
for different thermal sensors (e.g., thermal_zone0
). each thermal_zone
should have a temp
file that stores the current temperature in millidegree Celsius. so, all you need to do is to inspect such a file with your Python script.
from lcd.
wondering if you could help a borderline noob with this
from lcd.
@SgtKiLLx , you can implement this in many different ways. take a look at the demos for examples of how to interface with the LED driver.
regarding my previous comment, you can use the open()
method in Python to assign to a variable the current temperature of a thermal zone, like this:
# create a variable to store the current temperature of the zone0 thermal sensor
temp_zone0 = None
# get the current value from sysfs and assign to your temp_zone0 variable
with open("/sys/class/thermal/thermal_zone0/temp") as temp:
temp_zone0 = float(temp.read())/1000
# now you can do whatever you want with temp_zone0
if temp_zone0:
print(f"The current temperature of the thermal_zone0 sensor is {temp_zone0} degrees Celsius")
else:
print("Unable to read the temperature of the thermal_zone0 sensor")
however, instead of print
, you have to insert a logic to display the string on the LED. there are many examples in the demos that illustrate how to do exactly that. in addition, you might want to wrap such code in a loop (for
, while
) to display new temperature readings over time. for a better implementation, you would wrap the with
statement in a try block to catch an OSError
exception that open()
might raise.
from lcd.
Related Issues (20)
- smbus is not recognized HOT 20
- No module named smbus HOT 1
- No module named smbus HOT 4
- No module named smbus (sorry if not correct label..)
- Maintaining Python 2.7 compatibility moving forward HOT 1
- Favourite HOT 1
- Removal of the default 'pi' user
- turn off the lcd screen HOT 6
- > ```python
- module not imported running python script at startup raspberry pi /etc/profiles HOT 2
- Cannot run install.sh HOT 5
- Display IP adress HOT 2
- Displaying the IP address shows a b' in front of IP address HOT 2
- demo_tiny_dashboard is broken as Theysaidso api is no longer public
- demo_forex.py is broken because requests is blocked by cloudflare HOT 1
- Omision on README about quotable.io quote length restrictions HOT 2
- LCD Spotify Now Playing + Telegram Bot HOT 7
- BACKLIGHT can't stay in OFF mode
- cc.load_custom_characters_data() not working HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lcd.