2022年6月19日日曜日

LearnigKit for RaspPiPico Part Two




#oled_ssd1306.py

#Gnd-Gnd VCC-VBUS SDA-GP0 SCL-GP1

import machine

import ssd1306

import time


sda = machine.Pin(0)

scl = machine.Pin(1)

i2c = machine.I2C(0,sda=sda, scl=scl, freq=400000)


oled = ssd1306.SSD1306_I2C(128, 64, i2c)


oled.text("Hello everyone", 0, 5)

oled.show()

time.sleep(2)

oled.text("Welcome to my", 0, 15)

oled.text("blog", 10, 25)

oled.show()

time.sleep(2)

oled.text("Thank You", 0, 35)

oled.show()


#lcd_1602.py

#Gnd-Gnd VCC-VBUS SDA-GP0 SCL-GP1

import machine

from machine import I2C

from lcd_api import LcdApi

from i2c_lcd import I2cLcd

from time import sleep


I2C_ADDR = 0x27

totalRows = 2

totalColumns = 16


i2c = I2C(0, sda=machine.Pin(0), scl=machine.Pin(1), freq=400000)

lcd = I2cLcd(i2c, I2C_ADDR, totalRows, totalColumns)


while True:

    lcd.putstr("Lets Count 0-10!")

    sleep(2)

    lcd.clear()

    for i in range(10):

        lcd.putstr(str(i))

        sleep(1)

        lcd.clear()


 

0 件のコメント:

コメントを投稿