GithubHelp home page GithubHelp logo

Comments (3)

cgomesu avatar cgomesu commented on June 13, 2024

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.

SgtKiLLx avatar SgtKiLLx commented on June 13, 2024

wondering if you could help a borderline noob with this

from lcd.

cgomesu avatar cgomesu commented on June 13, 2024

@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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.