from gpiozero import LED
#we are using the LED sub-module just as a generic output
fan = LED(18) #for the positive, put the negative in one of the grounds
def cputemp():
f = open("/sys/class/thermal/thermal_zone0/temp")
CPUTemp = f.read()
f.close()
StringToOutput= str(int(CPUTemp)/1000)
while True:
cputemp()
if StringToOutput >= 45:
fan.on()
elif StringToOutput < 45:
fan.off
This is some fairly simple code that gets the temperature from /sys/class/thermal/thermal_zone0/temp in thousandths Celsius divides by 1000 for Celsius and checks if it is more than 45. if it is it turns the "fan" on and if not , it stays off. But you'll almost certainly never need a fan as long as you're not doing anything stupid.
This code was adapted from a SE question but i am not sure which.
Font Squirrel scours the internet in search of FREE, highest-quality, designer-friendly, commercial-use fonts and presents them for easy downloading. We dont have the most, but we do have the best.
Alpha Protocol - Sony PlayStation 3 (PS3) at ShopTo.Net - The Online UK Video Games and console Superstore. We specialise in PlayStation 2, PS2, PlayStation 3, PS3, Nintendo Wii, Wii, Nintendo DS Lite, Microsoft Xbox 360, consoles and accessories.
We write this guide how to read the store with Umbrella SHSH On File 3GS certificate for its iPhone and iPod Touch 2G/3G and. Umbrella is based on JAVA SHSH