I'm trying to send 2 different sequences of bytes using a momentary button widget in Node Red. I want to send a buffer (NOT an array) of raw bytes [145,48,64] when a button (with configurable color) is pressed, and then a different buffer [129,48,64] of raw bytes when that button (with different color) is released. I'm not a JS or HTML programmer. Just a hacker with some Node Red experience. Here is the code I'm using as a modified Template Node from someone else:
var bon = Buffer.from([145,48,64]);
var boff = Buffer.from([129,48,64]);
this.scope.on = {payload: bon};
this.scope.off = {payload: boff};
</script>
<md-button
ng-touchstart="send(on)"
ng-mousedown="send(on)"
ng-touchend="send(off)"
ng-mouseup="send(off)">
C4
</md-button>
Ideally the code could be buried in a single Node (like the Template Node) with the buffer values embedded in that node since I'm trying to create a control panel with lots of these buttons and don't want a clogged up Node Red IDE.
I'd appreciate any help. Thanks in advance.