Skip to content

Commit 956c81d

Browse files
committed
feat: add new arduino pattern to LED display and update drawMatrix command
1 parent 1d992a7 commit 956c81d

File tree

1 file changed

+13
-3
lines changed
  • scratch-prg-extensions/extensions/src/arduino_basics

1 file changed

+13
-3
lines changed

scratch-prg-extensions/extensions/src/arduino_basics/index.ts

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,16 @@ const PATTERNS = {
3535
[0, 0, 0, 0, 7, 0, 0, 0, 7, 0, 0, 0, 0],
3636
[0, 0, 0, 0, 0, 7, 0, 7, 0, 0, 0, 0, 0],
3737
] as number[][],
38+
arduino: [
39+
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
40+
[0, 0, 7, 7, 7, 0, 0, 0, 7, 7, 7, 0, 0],
41+
[0, 7, 0, 0, 0, 7, 0, 7, 0, 0, 0, 7, 0],
42+
[7, 0, 0, 0, 0, 0, 7, 0, 0, 7, 0, 0, 7],
43+
[7, 0, 7, 7, 7, 0, 7, 0, 7, 7, 7, 0, 7],
44+
[7, 0, 0, 0, 0, 0, 7, 0, 0, 7, 0, 0, 7],
45+
[0, 7, 0, 0, 0, 7, 0, 7, 0, 0, 0, 7, 0],
46+
[0, 0, 7, 7, 7, 0, 0, 0, 7, 7, 7, 0, 0]
47+
] as number[][],
3848
empty: Array(8).fill(null).map(() => Array(13).fill(0)) as number[][],
3949
} as const;
4050

@@ -63,17 +73,17 @@ export default class ArduinoBasics extends extension(details, "ui", "customArgum
6373
}
6474

6575
@scratch.command(function(_, tag) {
66-
const pattern = PATTERNS.heart;
6776
const arg = this.makeCustomArgument({
6877
component: MatrixArgument,
6978
initial: {
70-
value: pattern,
71-
text: "heart",
79+
value: PATTERNS.arduino,
80+
text: "arduino",
7281
},
7382
});
7483
return tag`draw ${arg} matrix`;
7584
})
7685
drawMatrix(matrix: number[][]) {
86+
console.log("atic sendnd", matrix);
7787
var matrixString = matrix.flat().join("");
7888
console.log("received matrix update", matrixString);
7989
if (this.socket) {

0 commit comments

Comments
 (0)