|
I/O | 引脚名称 | 描述 |
I | GP16 | 连接到W5500的MISO |
O | GP17 | 连接到W5500的CSn |
O | GP18 | 连接到W5500的SCLK |
O | GP19 | 连接到W5500的MOSI |
O | GP20 | 连接到W5500的RSTn |
I | GP21 | 连接到W5500的INTn |
I | GP24 | VBUS sense - high if VBUS is present, else low |
O | GP25 | 用户LED |
I | GP29 | Used in ADC mode (ADC3) to measure VSYS/3 |
O | GP15 | 连接到显示模块DI |
O | GP14 | 连接到显示模块CLK |
O | GP13 | 连接到显示模块CS |
# 测试任务1 入门任务
import time
import board
import busio
import digitalio
import adafruit_sharpmemorydisplay
def led_flush():
led.value = not led.value
time.sleep(0.5)
def clear_disp():
# Clear the display. Always call show after changing pixels to make the display
# update visible!
display.fill(1)
display.show()
def disp_helloworld():
print("hello world")
display.fill(1)
display.text(" hello world!", 30, 50, 0)
display.show()
if __name__ == '__main__':
led = digitalio.DigitalInOut(board.GP25)
led.direction = digitalio.Direction.OUTPUT
# Initialize SPI bus and control pins
spi = busio.SPI(board.GP14, MOSI=board.GP15)
scs = digitalio.DigitalInOut(board.GP13) # inverted chip select
# pass in the display size, width and height, as well
# display = adafruit_sharpmemorydisplay.SharpMemoryDisplay(spi, scs, 96, 96)
display = adafruit_sharpmemorydisplay.SharpMemoryDisplay(spi, scs, 144, 168)
clear_disp()
disp_helloworld()
while True:
led_flush()
程序运行后,在显示模块中间显示了一行文字“hello world”,同时小灯闪烁,入门任务的要求达到了。