Hello world!
from microbit import *
import mb_i2c_lcd1602
lcd = mb_i2c_lcd1602.LCD1620()
lcd.puts("hello world!")
sleep(2000)
lcd.clear()
Δοκιμή κουμπιών
from microbit import *
import mb_i2c_lcd1602
lcd = mb_i2c_lcd1602.LCD1620()
while True:
if button_a.was_pressed():
lcd.puts("A",x=2,y=0)
if button_b.was_pressed():
lcd.puts("B",x=5,y=0)
if pin_logo.is_touched():
lcd.puts("Touch",x=8,y=0)
sleep(500)
lcd.clear()
Εναλλαγή οπίσθιου φωτισμού
from microbit import *
import mb_i2c_lcd1602
lcd = mb_i2c_lcd1602.LCD1620()
lcd.puts("hello!",x=2,y=0)
while True:
if display.read_light_level() < 50:
lcd.backlight(1)
else:
lcd.backlight(0)