[ create a new paste ] login | about

Link: http://codepad.org/jTxAhxA7    [ raw code | output | fork ]

Python, pasted on Apr 25:
from time import sleep_ms
from machine import Pin, I2C
from ssd1306 import SSD1306_I2C

buf = "screen"
led = Pin(2, Pin.OUT)


i2c = I2C(-1, Pin(4),Pin(5),freq=40000) # Bitbanged I2C bus

oled = SSD1306_I2C(128, 64, i2c)
oled.invert(0) # White text on black background
oled.contrast(255) # Maximum contrast

for j in range(0, 500):
    led.on()
    sleep_ms(100) 
    led.off()      
    oled.fill(0)
    oled.text(buf[j%len(buf):]+buf, 10, 10)
    oled.show()
    sleep_ms(40)


Output:
1
2
3
4
Traceback (most recent call last):
  Line 1, in <module>
    from time import sleep_ms
ImportError: cannot import name sleep_ms


Create a new paste based on this one


Comments: