This is the code for read temperature with thermistor 10k sensor on i2c bus.
- GreenPonik_Thermistor10k.py Library for Raspberry pi
- Table of Contents
- Dev workflow
- Installation
- Methods
- Example
- Credits
create python virtual environnement
python3 -m venv venv
activate venv linux
source venv/bin/activate
activate venv windows
venv\Scripts\activate
install dependencies
pip install -r requirements.txt
install dependencies for the documentation
pip install Sphinx sphinx-press-theme m2r2
build documentation
cd docs/ && make clean html
> git clone https://github.com/GreenPonik/GreenPonik_Thermistor10k.git
cd GreenPonik_Thermistor10k
pip3 install -r requirements.txt
or
> pip install greenponik-thermistor10k
from GreenPonik_Thermistor10k.Thermistor10k import Thermistor10k
"""
Get temperatue in celcius
"""
def read_temp():
import time
from GreenPonik_Thermistor10k.Thermistor10k import Thermistor10k
if __name__ == "__main__":
try:
th = Thermistor10k()
th.debug = True # used for debug
while True:
temperature = th.read_temp()
print("celcius temp %.3f °c" % temperature)
time.sleep(1)
except Exception as e:
print("oops there is an exception {}".format(e))
Write by Mickael Lehoux, from GreenPonik, 2020