lms-esp32-pybricks-info

The Pixy2 camera can be connected with different interfaces to the LMS-ESP32 board.

Below examples read the version info.

SPI

from machine import Pin, SoftSPI
pixy = SoftSPI(baudrate=1000000, sck=Pin(13), mosi=Pin(14), miso=Pin(12))
pixy.write(bytes.fromhex('aec10e00'))
print(pixy.read(32))

I2C

from machine import Pin, SoftI2C
pixy = SoftI2C(freq=1000000, scl=Pin(13), sda=Pin(14))
print(pixy.scan())
pixy.writeto(84, bytes.fromhex('aec10e00'))
print(pixy.readfrom(84, 22))

Serial

from machine import Pin, UART
pixy = UART(1, baudrate=115200, rx=Pin(13), tx=Pin(14), timeout=20)
pixy.write(bytes.fromhex('aec10e00'))
print(pixy.read(22)) # min timeout=10, no response before