상세 컨텐츠

본문 제목

Raspberry pi 3 Temperature print in python

개발생활/Raspberry pi (Rpi)

by 한국인맛집 2019. 1. 8. 17:37

본문

반응형

Raspberry pi 3 temperature check code in python 





  • Python code


// tempChecker.py

import os
import time

def TempCheck():
    temp = os.poepn('vcgencmd measure_temp').readline()
    return (temp.replace('temp=',''))



times = time.strftime('%Y/%m/%D  %H:%M:%S')
print( times +"==>" + TempCheck())


  • Crontab

// bash
crontab -e


  • Add Cronjob

// 10 Minute run python 
*/10 * * * *  python /home/pi/TempChecker.py >> /home/pi/TemperatureLog.txt
//  Minute  | Houre | day(Month) |  Month | day(Week)

반응형

관련글 더보기