You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

27 lines
760 B

# pour installer la librairie MCP9808 :
# cd ~
# git clone https://github.com/adafruit/Adafruit_Python_MCP9808.git
# Attention à la version de python par défaut ( python --version)
# Si ce n'est pas la bonne :
# sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.7 1
# cd Adafruit_Python_MCP9808
# sudo python setup.py install
import RPi.GPIO as GP
import time
import Adafruit_MCP9808.MCP9808 as mcp
import threading
# initialisation du raspberry
capteurTemp = mcp.MCP9808()
# Test capteur de température
print("appuyer sur BP1 pour lancer le test capteur de température")
capteurTemp.begin()
for i in range(5):
temperature = capteurTemp.readTempC()
print("Température = ",temperature, " °C")
time.sleep(0.5)