Skip to content

Commit

Permalink
Add mip support
Browse files Browse the repository at this point in the history
  • Loading branch information
mcauser committed Feb 13, 2024
1 parent ac34d25 commit 9dd5d5b
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 4 deletions.
38 changes: 34 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,36 @@ For example, the Seeed Studio [Grove - Chainable RGB LED](https://wiki.seeedstud

![demo](docs/demo.jpg)

## Example

Copy the file to your device, using ampy, webrepl or compiling and deploying. eg.
### Installation

Using mip via mpremote:

```bash
$ mpremote mip install github:mcauser/micropython-p9813
$ mpremote mip install github:mcauser/micropython-p9813/examples
```
$ ampy put p9813.py

Using mip directly on a WiFi capable board:

```python
>>> import mip
>>> mip.install("github:mcauser/micropython-p9813")
>>> mip.install("github:mcauser/micropython-p9813/examples")
```

Manual installation:

Copy `src/p9813.py` to the root directory of your device.


## SPI Version

You can use either HSPI or SPI. This version is significantly faster than the
bit-bang version. MISO is not used. The LED driver is write only.

### SPI Example

**Basic usage**

```python
Expand Down Expand Up @@ -126,7 +148,15 @@ chain[2:] = [(0, 0, 255)] * 8
chain.reset()
```

See [p9813_examples.py](p9813_examples.py) and [examples](examples/) for more.
For more detailed examples, see [examples](/examples).

If you mip installed them above, you can run them like so:

```python
import p9813.examples.basic
```


## Chaining

You can connect multiple LEDs together to form a chain.
Expand Down
26 changes: 26 additions & 0 deletions examples/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"urls": [
["p9813/examples/auto_write.py", "github:mcauser/micropython-p9813/examples/auto_write.py"],
["p9813/examples/basic.py", "github:mcauser/micropython-p9813/examples/basic.py"],
["p9813/examples/bitbang.py", "github:mcauser/micropython-p9813/examples/bitbang.py"],
["p9813/examples/bounce.py", "github:mcauser/micropython-p9813/examples/bounce.py"],
["p9813/examples/color_wipe.py", "github:mcauser/micropython-p9813/examples/color_wipe.py"],
["p9813/examples/cycle.py", "github:mcauser/micropython-p9813/examples/cycle.py"],
["p9813/examples/fade.py", "github:mcauser/micropython-p9813/examples/fade.py"],
["p9813/examples/fill.py", "github:mcauser/micropython-p9813/examples/fill.py"],
["p9813/examples/hw_spi.py", "github:mcauser/micropython-p9813/examples/hw_spi.py"],
["p9813/examples/level.py", "github:mcauser/micropython-p9813/examples/level.py"],
["p9813/examples/rainbow_cycle.py", "github:mcauser/micropython-p9813/examples/rainbow_cycle.py"],
["p9813/examples/rainbow_fade.py", "github:mcauser/micropython-p9813/examples/rainbow_fade.py"],
["p9813/examples/rainbow.py", "github:mcauser/micropython-p9813/examples/rainbow.py"],
["p9813/examples/random.py", "github:mcauser/micropython-p9813/examples/random.py"],
["p9813/examples/rgb.py", "github:mcauser/micropython-p9813/examples/rgb.py"],
["p9813/examples/slice.py", "github:mcauser/micropython-p9813/examples/slice.py"],
["p9813/examples/sw_spi.py", "github:mcauser/micropython-p9813/examples/sw_spi.py"],
["p9813/examples/theater_chase_rainbow.py", "github:mcauser/micropython-p9813/examples/theater_chase_rainbow.py"],
["p9813/examples/theater_chase.py", "github:mcauser/micropython-p9813/examples/theater_chase.py"],
["p9813/examples/traffic_lights.py", "github:mcauser/micropython-p9813/examples/traffic_lights.py"]
],
"deps": [],
"version": "2.0.0"
}
7 changes: 7 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"urls": [
["p9813/__init__.py", "github:mcauser/micropython-p9813/src/p9813.py"]
],
"deps": [],
"version": "2.0.0"
}

0 comments on commit 9dd5d5b

Please sign in to comment.