from network import WLAN, STA_IF
from time import localtime, time, sleep_ms
from ntptime import settime
from machine import Pin, I2C
from ssd1306 import SSD1306_I2C
from framebuf import FrameBuffer, MONO_HLSB
import gc
from rede import Rede
r = Rede("Wokwi-GUEST", "", conecta=False)
r.conectar(tentativas=40, intervalo=500)
try:
if r.conectado:
settime()
except OSError as e:
print ("Deu ruim")
print (e)
ts = localtime()
print(ts)
i2c = I2C(0, scl=Pin(9), sda=Pin(8), freq=400000) # I2C no ESP32
oled_width = 128
oled_height = 64
oled = SSD1306_I2C(oled_width, oled_height, i2c)
def mostrarTimestamp():
global n
m = f'Turno: {n:04d}'
oled.fill(0) # Limpa o display
oled.text(m, 10, 10) # Escreve no display nas coordenadas x e y
oled.show()
n = 0
while True:
mostrarTimestamp()
n += 1
sleep_ms(1000)Loading
aitewinrobot-esp32c3-supermini
aitewinrobot-esp32c3-supermini