I finally have the code for my Existentialist's Watch. The watchface shows the word "Now" in the center of the screen. If you find a need for the terrestrial time, press the button and the current time will display for five seconds, then revert back to "Now".
// Display the "Now" message on the Bangle.js 2 watch
function showNow() {
g.clear();
g.setFontAlign(0, 0);
g.setFont("Vector", 48);
g.drawString("Now", g.getWidth() / 2, g.getHeight() / 2);
return true;
}
// Display the current time on the Bangle.js 2 watch
function showTime() {
// Get the current time
var date = new Date();
var hours = date.getHours();
var minutes = date.getMinutes();
// Format the time as a string
var timeString = hours.toString().padStart(2, "0") + ":" +
minutes.toString().padStart(2, "0") + ":" +;
// Display the time on the screen
g.clear();
g.setFontAlign(0, 0);
g.setFont("Vector", 42);
g.drawString(timeString, g.getWidth() / 2, g.getHeight() / 2);
// Revert to the "Now" display after 5 seconds
setTimeout(showNow, 5000);
}
// Set up a button listener to display the time
setWatch(showTime, BTN1, { repeat: true });
// Display the "Now" message on start-up
showNow();
It's simplistic, no widgets and such, but I'm sure somebody will jazz it up if they want.
This is the main reason I bought the Bangle.js 2. So happy now.
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.
I finally have the code for my Existentialist's Watch. The watchface shows the word "Now" in the center of the screen. If you find a need for the terrestrial time, press the button and the current time will display for five seconds, then revert back to "Now".
It's simplistic, no widgets and such, but I'm sure somebody will jazz it up if they want.
This is the main reason I bought the Bangle.js 2. So happy now.