Пример #1
0
#     data = bytearray(f.read())
#     print('dim', dim)
#     print('data', data)

FW = 64
FH = 64
buffer = bytearray(
    b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00~\x00\x00\x00\x00\x00\x00\x00~@\x00\x00\x00\x00\x00\x00\x7f`\x00\x00\x00\x00\x00\x01\xfft\x00\x00\x00\x00\x00\x00\x7f\xf8\x00\x00\x00\x00\x00\x03\xdf\xca\x00\x00\x00\x00\x00\x03\x00y\x80\x00\x00\x00\x00\x06\x00\x1e\xc0\x00\x00\x00\x00\x04~\x03`\x00\x00\x00\x00\x08\xff\x81\xbf\xc0\x00\x00\x00\x19\xc3\xf8\xd8\xe0\x00\x00\x00\x1d\x01\xfcc\xf0\x00\x00\x000\x00\x1eo\xf0\x00\x00\x000\x00\x03`\xf0\x00\x00\t(\x00\x03\x00\xf0\x00\x00\rh\x00\x01\x07\xe0\x00\x00b\xe0`\x00\x07\xc0\x00\x00?pa\x00w\xc0\x00\x00\x170c\x00|\x00\x00\x00\x08\x00C\x00\x1c\x00\x00\x00|\x00\x03\x03L\x00\x00\x00D\x00\x02\x02H\x00\x00\x000\x03\x90\x03\x98\x00\x00\x00\x08\x0f\xf8\x03\xff\x00\x00x\x00\x08\x1c\x02\xdf\xc0\x00\xc6|\x0f\xe6\x00\x8c\x00\x01\x86\x18\x0f\xf6\x00\x06\x00\x01\x06\x1c\x0f\xfa\x00\x07\x809\x06~\x07\xfe\x00\x04\xc0}\x84\xc3\x03\xfc\x00\x02@\xc6\x84\x83\x01\xf0\x0f\x05\x00\xc2\x86\x83\x0c\x00;\x9f\x00\x81\x83\x83\x87\x80 \xf1\x80\xc1\x87\x06a\xf0`\xe0\xc0`"\x04\xb0\xf8`\xe0\xc0\x10\x00\x08\x18\x00 \xe0\xc0\x18\x00\x18\xdc\x00 `\x80\x18\x00\x11\xee\x00 a\x9c\x18\x002\'\xc3 \xe1~\x18\x00.\xe0\xfe0\xc1\xc3\x18\x00?\x80\x00\xb0\x01\x83\x18\x00s\xc0\x00\xb0\x00A\x18\x00}\x80\x01\xf0\x00\x01\x08\x00\x0f\x00\x00 \x00\x03\x06\x00\x03\x80\x07`\x00\x1e\x03\x00\x01\x80\x1f\xe0\x008\x03\x0c\x03\x000\x00\x00@\x03\xef\x86\x00 \x00\x00\xc0\x02\xfe\xfc\x000\x00\x00\x80\x06\x7f|\x00\x10\x00\x00\x80\x04\x1f<\x00\x18\xe0\x01\x80\x04\x07\x18\x00\x0f\xfc\x03\x00\x0c\x07\x90\x00\x03\xf6\x1f\x00\x0f\xff\xf8\x00\x0b\xfb\xfd\x80\x0f\xfe\xf8\x00\x0c\xb7\xf8\xc0\x08\xf1p\x00\x02\x1f\x80\xe0\x0c\x01p\x00\x08\x1d\x81\xf0\x08\x03p\x00\x188\x83\xd8\x0c\x06\xd0\x00\x18\xf9\xcf\x9c\x0c\x1c\xa0\x00\x1f\xf9\xff\x1c\x07\xfd\xa0\x00\x1f\xf9\x80~\x03\xe1\xa0\x00\x10)\x01\xf3\x03\xff\xff\xff\xff\xff\xff\xff'
)

fb = framebuf.FrameBuffer(buffer, FW, FH, framebuf.MONO_HLSB)

# Clear the oled display in case it has junk on it.
oled.fill(0)

# Blit the image from the framebuffer to the oled display
oled.blit(fb, WIDTH - FW, HEIGHT - FH)

# Add some text
if FW + FH <= 64:
    oled.text("Raspberry Pi", 5, 5)
    oled.text("Pico", 5, 20)
    oled.text("with", 5, HEIGHT - 25)
    oled.text("Micropython", 5, HEIGHT - 15)
else:
    oled.text("Hobbes?!", 3, 3)
    oled.invert(1)

# Finally update the oled display so the image & text is displayed
oled.show()
Пример #2
0
topic = 'sonos/{}/track'.format(loc)

print("mqtt_id =", mqtt_id)
print("host =", mqtt_aws_host)
print("topic =", topic)

p15 = Pin(15, Pin.IN, Pin.PULL_UP)  #button on homemade volume play/pause board

adc = ADC(Pin(36))

i2c = I2C(scl=Pin(22), sda=Pin(23))  #speed=100000 is the default

d = SSD(width=128, height=32, i2c=i2c, external_vcc=False)
d.init_display()
d.text("Hello Steve", 0, 0)
d.show()

print("version plays wnyc")
print("mqtt_id =", mqtt_id)
print("location =", loc)
print("mqtt_aws_host =", mqtt_aws_host)


def wrap(text, lim):
    lines = []
    pos = 0
    line = []
    for word in text.split():
        if pos + len(word) < lim + 1:
            line.append(word)