All you need to do is...
_examplePlugin.js
plugins
Replace the contents of the init function with something like:
init
Espruino.Core.App.addIcon({ id: "sendTime", icon: "star", title : "Send the current Time", order: 300, area: { name: "code", position: "bottom" }, click: sendTime });
Then add a sendTime function that calls:
sendTime
Espruino.Core.Serial.write(`\x03\x10setTime(....)\n`, false, function() { Espruino.Core.Notifications.success(`Sent the time`, true); });
And I think you'll be done. It might be a nice thing to have as an option, so you could copy the code from https://github.com/espruino/EspruinoWebIDE/blob/master/js/plugins/codeLink.js which puts an option in Settings which shows/hides the icon when toggled
@Gordon started
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.
All you need to do is...
_examplePlugin.js
to a new JS file in theplugins
folderReplace the contents of the
init
function with something like:Then add a
sendTime
function that calls:And I think you'll be done. It might be a nice thing to have as an option, so you could copy the code from https://github.com/espruino/EspruinoWebIDE/blob/master/js/plugins/codeLink.js which puts an option in Settings which shows/hides the icon when toggled