Skip to content

Commit 9208b08

Browse files
committed
feat: add matrixClear command to ArduinoBasics extension
1 parent 21d1db2 commit 9208b08

File tree

1 file changed

+14
-1
lines changed
  • scratch-arduino-extensions/packages/scratch-vm/src/extensions/arduino_basics

1 file changed

+14
-1
lines changed

scratch-arduino-extensions/packages/scratch-vm/src/extensions/arduino_basics/index.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@ const iconURI = "";
1919
// eslint-disable-next-line max-len
2020
const menuIconURI = "";
2121

22-
const wsServerURL = `${window.location.protocol}//${window.location.hostname}:7000`;
22+
// const wsServerURL = `${window.location.protocol}//${window.location.hostname}:7000`;
2323

24+
const wsServerURL = `ws://192.168.1.39:7000`;
2425
class ArduinoBasics {
2526
constructor(runtime) {
2627
this.runtime = runtime;
@@ -52,6 +53,13 @@ ArduinoBasics.prototype.getInfo = function() {
5253
},
5354
},
5455
},
56+
{
57+
opcode: "matrixClear",
58+
blockType: BlockType.COMMAND,
59+
text: "clear matrix",
60+
func: "matrixClear",
61+
arguments: {},
62+
},
5563
{
5664
opcode: "setLed3",
5765
blockType: BlockType.COMMAND,
@@ -85,6 +93,11 @@ ArduinoBasics.prototype.matrixDraw = function(args) {
8593
this.io.emit("matrix_draw", { frame: args.FRAME });
8694
};
8795

96+
ArduinoBasics.prototype.matrixClear = function() {
97+
console.log("Clearing matrix");
98+
this.io.emit("matrix_draw", { frame: "0000000000000000000000000" });
99+
};
100+
88101
ArduinoBasics.prototype.setLed3 = function(args) {
89102
const hexColor = args.HEX;
90103
const rgb = this.hexToRgb(hexColor);

0 commit comments

Comments
 (0)