Skip to content

Circuit Python Compatability #2

@MishaShapo

Description

@MishaShapo

Does anyone know a good way of porting this library to work in a CircruitPython environment instead of MicroPython?

I started with this:

import sys
import time
import motoron
import board
import busio
from microcontroller import Pin
from adafruit_bus_device.i2c_device import I2CDevice

DEVICE_ADDRESS = 0x10  # device address of DS3231 board

bus = busio.I2C(board.IO15, board.IO7)
device = I2CDevice(bus, DEVICE_ADDRESS)
mc = motoron.MotoronI2C(bus=device)

but I am running into this:

Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.
code.py output:
Traceback (most recent call last):
  File "code.py", line 45, in <module>
  File "/lib/motoron.py", line 363, in reinitialize
  File "/lib/motoron.py", line 1744, in _mpy_send_command_core
AttributeError: 'I2CDevice' object has no attribute 'writeto'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions