[修改] 增加Led、Oled目录
This commit is contained in:
33
main.py
Normal file
33
main.py
Normal file
@ -0,0 +1,33 @@
|
||||
import os
|
||||
import sys
|
||||
import time
|
||||
import RPi.GPIO as GPIO
|
||||
import spidev as SPI
|
||||
sys.path.append(os.path.join(os.path.dirname(__file__),'Oled'))
|
||||
import SSD1306
|
||||
|
||||
from PIL import Image,ImageDraw,ImageFont
|
||||
|
||||
# Raspberry Pi pin configuration:
|
||||
OLED_GPIO_RST = 19
|
||||
OLED_GPIO_DC = 16
|
||||
OLED_SPI_BUS = 0
|
||||
OLED_SPI_CS = 0
|
||||
|
||||
LED_GPIO_RED = 26
|
||||
|
||||
# 128x64 display with hardware SPI:
|
||||
disp = SSD1306.SSD1306(OLED_GPIO_RST, OLED_GPIO_DC, SPI.SpiDev(OLED_SPI_BUS, OLED_SPI_CS))
|
||||
|
||||
def main():
|
||||
|
||||
try:
|
||||
while True:
|
||||
time.sleep(1)
|
||||
except:
|
||||
print("except")
|
||||
|
||||
if __name__=='__main__':
|
||||
main()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user