Skip to content
树莓派使用0.96寸oled显示系统信息
Python
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
beep
img
py_daemon
test
图片处理
.gitignore
ShowStatus.py
arial.ttf
raspi-boot.png
raspi-off.png
readme.md

readme.md

树莓派使用0.96寸oled显示系统信息。更多说明见:https://maplesugar.gitlab.io

i2c的oled屏幕,使用Adafruit_SSD1306库。

1.更改两个按钮GPIO号

def button_listening(self):
    RPi.GPIO.setmode(RPi.GPIO.BCM)
    ''' 按钮GPIO17,GPIO27 '''
    RPi.GPIO.setup(17, RPi.GPIO.IN, pull_up_down=RPi.GPIO.PUD_UP)    
    RPi.GPIO.setup(27, RPi.GPIO.IN, pull_up_down=RPi.GPIO.PUD_UP) 
    ''' 软件去抖,当检测到上升沿后,进入这个中断,在延时200ms中忽略上升沿。 实际测试,设置1000ms,可以消除连续执行两次的抖动。'''
    ''' add rising edge detection on a channel, ignoring further edges for 200ms for switch bounce handling '''
    RPi.GPIO.add_event_detect(17, RPi.GPIO.RISING, callback=self.button_event, bouncetime=1000) 
    RPi.GPIO.add_event_detect(27, RPi.GPIO.RISING, callback=self.button_event, bouncetime=1000)
You can’t perform that action at this time.