Created
December 28, 2019 05:00
-
-
Save choryuidentify/b037b7af1c981472f7f63811d1762036 to your computer and use it in GitHub Desktop.
calib_fan_opi.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# -*- coding: utf-8 -*- | |
import OPi.GPIO as GPIO | |
import time | |
import sys | |
#import os | |
FAN_PIN = 21 | |
WAIT_TIME = 1 | |
PWM_FREQ = 25 | |
GPIO.setboard(GPIO.PLUS2E) | |
GPIO.setmode(GPIO.BOARD) | |
GPIO.setup(FAN_PIN, GPIO.OUT, initial=GPIO.LOW) | |
fan=GPIO.PWM(FAN_PIN,PWM_FREQ) | |
fan.start(0); | |
i = 0 | |
hyst = 1 | |
tempSteps = [50, 70] | |
speedSteps = [0, 100] | |
cpuTempOld=0 | |
try: | |
while 1: | |
fanSpeed=float(input("Fan Speed: ")) | |
fan.ChangeDutyCycle(fanSpeed) | |
except(KeyboardInterrupt): | |
print("Fan ctrl interrupted by keyboard") | |
GPIO.cleanup() | |
sys.exit() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment