Page 119 - MDP2020-2
P. 119
················································································ 명장양성프로젝트 【MDP】 과제발표회 자료집 Ⅱ | 113
GPIO.output(fan,True)
if(fan_level==0):
self.button_fan.setStyleSheet('image:url(/home/pi/Desktop/VENT_OFF.png);
border:0px')
fan_p.ChangeDutyCycle(0)
elif(fan_level==1):
self.button_fan.setStyleSheet('image:url(/home/pi/Desktop/VENT_ON_1.png);
border:0px')
fan_p.ChangeDutyCycle(17)
elif (fan_level == 2):
self.button_fan.setStyleSheet('image:url(/home/pi/Desktop/VENT_ON_2.png);
border:0px')
fan_p.ChangeDutyCycle(40)
elif (fan_level == 3):
self.button_fan.setStyleSheet('image:url(/home/pi/Desktop/VENT_ON_3.png);
border:0px')
fan_p.ChangeDutyCycle(100)
if (state_fan):
if (state_led):
self.notice.setText("UV, %d단계 환기가 작동중입니다."%(fan_level))
else:
self.notice.setText("%d단계 환기가 작동중입니다."%(fan_level))
else:
if (state_led):
self.notice.setText("UV, 환기 작동을 멈췄습니다.")
else:
self.notice.setText("환기 작동을 멈췄습니다.")
def led(self, state_led):
if (state_led):
self.button_led.setStyleSheet('image:url(/home/pi/Desktop/UV_ON.png); border:0px')
GPIO.output(led, True)
if (state_fan):
self.notice.setText("UV, %d단계 환기가 작동중입니다."%(fan_level))
else:
self.notice.setText("UV가 작동중입니다.")
else:
self.button_led.setStyleSheet('image:url(/home/pi/Desktop/UV_OFF.png); border:0px')
GPIO.output(led, False)
if (state_fan):
self.notice.setText("UV, 환기 작동을 멈췄습니다.")
else:
self.notice.setText("UV가 작동을 멈췄습니다.")
if __name__ == "__main__":