风扇控制代码,仅供参考:
打开风扇代码
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
GPIO.setup(17, GPIO.OUT)
#IO17输出HIGH打开风扇
GPIO.output(17, GPIO.HIGH)
----------------------------------------------------------------------------------------------------------
关闭风扇代码
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
GPIO.setup(17, GPIO.OUT)
#IO17输出LOW关闭风扇
GPIO.output(17, GPIO.LOW)