def initDisplay(i2c):
    global display, adc
    i2cDevices = I2C.scan(i2c)
    if 60 in i2cDevices:
        display = oled.SSD1306_I2C(64, 48, i2c)
        return True
    else:
        print('No OLED Display found')
        return False
コード例 #2
0
def initDisplay(i2c):
    global display, builtinLed
    i2cDevices = I2C.scan(i2c)
    if 60 in i2cDevices:
        display = oled.SSD1306_I2C(128, 64, i2c)
        return True
    else:
        builtinLed = Pin(builtinLedPin, Pin.OUT)
        return False
コード例 #3
0
from machine import I2C, Pin
from urtc import DS1307
import time

i2c_rtc = I2C(0, scl=Pin(17), sda=Pin(16))
result = I2C.scan(i2c_rtc)
rtc = DS1307(i2c_rtc)

led = Pin(25, Pin.OUT)
led.on()

G = Pin(4, Pin.OUT)
F = Pin(5, Pin.OUT)
A = Pin(6, Pin.OUT)
B = Pin(7, Pin.OUT)
D = Pin(9, Pin.OUT)
C = Pin(14, Pin.OUT)
E = Pin(15, Pin.OUT)
SEC = Pin(13, Pin.OUT)

states = Pin(19, Pin.IN, Pin.PULL_DOWN)
inc = Pin(26, Pin.IN, Pin.PULL_DOWN)

CA1 = Pin(0, Pin.OUT)
CA2 = Pin(1, Pin.OUT)
CA3 = Pin(2, Pin.OUT)
CA4 = Pin(3, Pin.OUT)

segs = [A, B, C, D, E, F, G]
numbers = [
    0b1000000, 0b1111001, 0b0100100, 0b0110000, 0b0011001, 0b0010010,