"""
Franzininho WiFi + CiruitPython demo
"""

import board
import busio
import digitalio
import time

# For most CircuitPython boards:
led = digitalio.DigitalInOut(board.IO33)
led2 = digitalio.DigitalInOut(board.IO21)

# For blink:
led.direction = digitalio.Direction.OUTPUT
led2.direction = digitalio.Direction.OUTPUT

# We have not yet tried to iniatialize the uarts
uart = busio.UART(board.IO17, board.IO18, baudrate=9600, timeout=1)

time.sleep(1.0)

led2.value = False

while True:
    led.value = True
    print("Sending command: AT")

    uart.write(b"AT\r\n")
    time.sleep(0.5)

    data = uart.read(32)  # read up to 32 bytes
    # print(data)  # this is a bytearray type

    if data is not None:
        # convert bytearray to string
        data_string = ''.join([chr(b) for b in data])
        print(data_string, end="")

        led.value = False
    else:
        print('Fail')
   
    led.value = False
    time.sleep(0.5)
Loading
franzininho-wifi
Loading
esp-01