Skip to content

Commit

Permalink
Merge pull request #239 from blind-coder/mapping_wh
Browse files Browse the repository at this point in the history
add examples for 2D maps
  • Loading branch information
netmindz authored Jan 11, 2025
2 parents beea0b1 + 5920040 commit 17c2086
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions docs/advanced/mapping.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,38 @@ It could be formatted any of the three ways demonstrated above.
{"map":[0, 1, 2, 3, 4, 9, 8, 7, 6, 5, 10, 11, 12, 13, 14,
19, 18, 17, 16, 15, 20, 21, 22, 23, 24, 29, 28, 27, 26, 25]}
```

The following example shows how to create a `ledmap.json` for LEDs arranged in a two-dimensional grid intead of a one-dimensional string.

Here, we have a serpentine of LEDs in 4 columns and 3 rows:
```json
{
"map": [
0, 1, 2, 3,
7, 6, 5, 4,
8, 9, 10, 11
],
"width": 4,
"height": 3
}
```

![wiring diagram of the 4x3 mapping](mapping/mapping_4x3.png)

A more complex example of 16 LEDs arrange in a double figure `` shape. This includes some missing LEDs showing up as `-1`.
Note that if a `ledmap.json` file exists, the `2d-gaps.json` file will be ignored.
```json
{"map":
[
-1, -1, 14, -1, 12, -1, 10, -1, -1,
-1, 15, -1, 13, -1, 11, -1, 9, -1,
0, -1, -1, -1, -1, -1, -1, -1, 8,
-1, 1, -1, 3, -1, 5, -1, 7, -1,
-1, -1, 2, -1, 4, -1, 6, -1, -1
],
"width": 9,
"height": 5
}
```

![wiring diagram of the double ∞ shape mapping](mapping/mapping_infinity_shape.png)
Binary file added docs/advanced/mapping/mapping_4x3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 17c2086

Please sign in to comment.