adafruit / adafruit/Adafruit_CircuitPython_NeoTrellis

Example code is broken 'object has no such attribute'

Open
#25 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
10
Forks
14
PR merge metrics
No merged PRs in 30d

Description

## Setup

Circuit Python 7.20230112.zip
Raspberry Pi Pico

## Problem

If a user attempts to follow the instructions to set this up, they will run into the following problems.

1. The instructions call for running this code
https://learn.adafruit.com/adafruit-neotrellis/circuitpython-code#circuitpython-and-python-usage-3002750
```python
import time
from board import SCL, SDA
import busio
from adafruit_neotrellis.neotrellis import NeoTrellis

#create the i2c object for the trellis
i2c_bus = busio.I2C(SCL, SDA)

#create the trellis
trellis = NeoTrellis(i2c_bus)
```

Which will produce error

`ImportError: cannot import name SCL`

2. If a user attempts to use the example [from the example directory](https://github.com/adafruit/Adafruit_CircuitPython_NeoTrellis/blob/main/examples/neotrellis_simpletest.py), they will encounter this error

`AttributeError: 'module' object has no attribute 'I2C'`

As a result, most users who aren't experienced python developers will likely give up.

## Additional Information

1. The guide for Trellis was released in September 2018
2. The website [circuitpython.com](https://circuitpython.org/libraries) did not exist at that point in time so its difficult to tell what the latest version of circuit python was.

## Theory

I suspect that the library versions that are provided in the circuit python bundle are vastly different that the ones that the user is instructed to download

[jan 12, 2023](https://github.com/adafruit/Adafruit_CircuitPython_Bundle/releases/tag/20230112)

## Solution

1. Document which versions of the library the user should install
2. Update the instructions to work with the latest library

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the linked CircuitPython and Python usage guide and examples/neotrellis_simpletest.py, then compare their imports and I2C usage with CircuitPython 7.20230112 and the bundled library versions. Done means the guide and example work with the stated setup and clearly document the required library versions.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
documentation, embedded-iot
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.