1.点灯学习
最近在学树莓派,在这做点记录~
import RPi.GPIO as GPIO
import PySimpleGUI as sg
GPIO.setmode(GPIO.BCM)
GPIO.setup(26, GPIO.OUT)
def main():
layout = [[sg.Text('LED点灯控制')],
[sg.Button('', image_data=toggle_btn_off,
key='-TOGGLE-GRAPHIC-',
button_color=(sg.theme_background_color(),
sg.theme_background_color()), border_width=0)],
]
window = sg.Window('点灯控制', layout)
graphic_off = True
while True:
event, values = window.read()
if graphic_off:
GPIO.output(26, True)
else:
GPIO.output(26, False)
GPIO.output(26, False)
if event in (sg.WIN_CLOSED, 'Exit'):
break
elif event == '-TOGGLE-GRAPHIC-':
graphic_off = not graphic_off
window['-TOGGLE-GRAPHIC-'].update(image_data=toggle_btn_off if graphic_off else toggle_btn_on)
window.close()
if __name__ == '__main__':
toggle_btn_off = b'iVBORw0KGgoAAAANSUhEUgAAAGQAAAAoCAYAAAAIeF9DAAAPpElEQVRoge1b63MUVRY//Zo3eQHyMBEU5LVYpbxdKosQIbAqoFBraclatZ922Q9bW5b/gvpBa10+6K6WftFyxSpfaAmCEUIEFRTRAkQFFQkkJJghmcm8uqd763e6b+dOZyYJktoiskeb9OP2ne7zu+d3Hve2smvXLhqpKIpCmqaRruu1hmGsCoVCdxiGMc8wjNmapiUURalGm2tQeh3HSTuO802xWDxhmmaraZotpmkmC4UCWZZFxWKRHMcZVjMjAkQAEQqFmiORyJ+j0ei6UCgUNgyDz6uqym3Edi0KlC0227YBQN40zV2FQuHZbDa7O5fLOQBnOGCGBQTKNgzj9lgs9s9EIrE4EomQAOJaVf5IBYoHAKZpHs7lcn9rbm7+OAjGCy+8UHKsD9W3ruuRSCTyVCKR+Es8HlfC4bAPRF9fHx0/fpx+/PFH6unp4WOYJkbHtWApwhowYHVdp6qqKqqrq6Pp06fTvHnzqLq6mnWAa5qmLTYM48DevXuf7e/vf+Suu+7KVep3kIWsXbuW/7a0tDREo9Ed1dXVt8bjcbYK/MB3331HbW1t1N7eTgAIFoMfxSZTF3lU92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ErkJggg=='
main()
利用树莓派的RPi.GPIO库对树莓派的GPIO接口进行控制,加上pysimpleGUI(pip install pysimpleGUI),进行灯亮灯灭控制,用的的树莓派的GPIO26
效果图:
|