Skip to content

Commit 17c2086

Browse files
authored
Merge pull request #239 from blind-coder/mapping_wh
add examples for 2D maps
2 parents beea0b1 + 5920040 commit 17c2086

File tree

3 files changed

+35
-0
lines changed

3 files changed

+35
-0
lines changed

docs/advanced/mapping.md

+35
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,38 @@ It could be formatted any of the three ways demonstrated above.
4646
{"map":[0, 1, 2, 3, 4, 9, 8, 7, 6, 5, 10, 11, 12, 13, 14,
4747
19, 18, 17, 16, 15, 20, 21, 22, 23, 24, 29, 28, 27, 26, 25]}
4848
```
49+
50+
The following example shows how to create a `ledmap.json` for LEDs arranged in a two-dimensional grid intead of a one-dimensional string.
51+
52+
Here, we have a serpentine of LEDs in 4 columns and 3 rows:
53+
```json
54+
{
55+
"map": [
56+
0, 1, 2, 3,
57+
7, 6, 5, 4,
58+
8, 9, 10, 11
59+
],
60+
"width": 4,
61+
"height": 3
62+
}
63+
```
64+
65+
![wiring diagram of the 4x3 mapping](mapping/mapping_4x3.png)
66+
67+
A more complex example of 16 LEDs arrange in a double figure `` shape. This includes some missing LEDs showing up as `-1`.
68+
Note that if a `ledmap.json` file exists, the `2d-gaps.json` file will be ignored.
69+
```json
70+
{"map":
71+
[
72+
-1, -1, 14, -1, 12, -1, 10, -1, -1,
73+
-1, 15, -1, 13, -1, 11, -1, 9, -1,
74+
0, -1, -1, -1, -1, -1, -1, -1, 8,
75+
-1, 1, -1, 3, -1, 5, -1, 7, -1,
76+
-1, -1, 2, -1, 4, -1, 6, -1, -1
77+
],
78+
"width": 9,
79+
"height": 5
80+
}
81+
```
82+
83+
![wiring diagram of the double ∞ shape mapping](mapping/mapping_infinity_shape.png)

docs/advanced/mapping/mapping_4x3.png

21.9 KB
Loading
Loading

0 commit comments

Comments
 (0)