admin

Май 222020
 

 

from machine import Pin, I2C
import ssd1306
from time import sleep

# 1 3 Busy

GREEN = Pin(0, Pin.OUT)    
GREEN.on()

BLUE_OLED = Pin(2, Pin.OUT)   
BLUE_OLED.on()

def do_connect():
    import network
    wlan = network.WLAN(network.STA_IF)
    wlan.active(True)
    if not wlan.isconnected():
        print('connecting to network...')
        wlan.connect('ssd', 'pass')
        while not wlan.isconnected():
            pass
    print('network config:', wlan.ifconfig())
    
do_connect()

i2c = I2C(-1, scl=Pin(4), sda=Pin(5))

print(i2c.scan())

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

oled.text('Hello, World 1!', 0, 0)
oled.text('Hello, World 2!', 0, 10)
oled.text('Hello, World 3!', 0, 20)
        
oled.show()


Янв 212020
 

Для заметки:

SSD1306Wire display(0x3c, 5, 4); // SDA GPIO5(D1) || SCL GPIO4 (D2)

pinMode(D4,OUTPUT);
digitalWrite(D4,HIGH); // SSD1306 LED is ON

pinMode(D5,INPUT);
pinMode(D6,INPUT);
pinMode(D7,INPUT);
pinMode(D8,INPUT);

pinMode(D3,OUTPUT);
pinMode(D0,OUTPUT);
digitalWrite(D3,LOW); // LED GREEN
digitalWrite(D0,LOW); // LED RED

 Posted by at 13:15