Hi,
I am trying to write a widget that shows the currently played track.
I have the following code:
//WIDGETS = {};
(() => {
var musicInfo;
var _GB = global.GB;
global.GB = (event) => {
switch (event.t) {
case "musicinfo":
musicInfo = event;
WIDGETS["mymusic"].draw();
break;
}
if(_GB)setTimeout(_GB,0,event);
};
function draw() {
g.reset();
g.clearRect(this.x,this.y,this.x+176,this.y+16);
g.setFont("Vector",16);
if (musicInfo !== undefined) {
g.drawString(musicInfo.track,this.x,this.y);
}
}
WIDGETS["mymusic"]={area:"bl",width:176,draw:draw};
})();
//Bangle.drawWidgets();
When loading into RAM it works. When using the left side of Espruino Web IDE and sending GB messages, the tracks are displayed.
However, when loading the code in storage, it does not work. No tracks are displayed.
What is the difference between RAM and storage?
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Hi,
I am trying to write a widget that shows the currently played track.
I have the following code:
When loading into RAM it works. When using the left side of Espruino Web IDE and sending GB messages, the tracks are displayed.
However, when loading the code in storage, it does not work. No tracks are displayed.
What is the difference between RAM and storage?