Do you have the Pico? If that's the case then this has never worked - you always have to either run it from a USB power supply (so there's no actual USB connection) or you need to run a terminal program when you're connected to your PC.
I'm working on fixing it - there is a beta version with it fixed (see the USB HID post) but there are some massive changes to USB, so I want to make sure it works fine before I release it.
Also: there is a bit of a problem with your code. You can end up calling g.flip() before (or while) the LCD is initialising, which can stop it working. Either try:
var initialised = false;
function onInit() {
var spi = new SPI();
spi.setup({ sck:B1, mosi:B10 });
// Initialize the LCD
g = require("PCD8544").connect(spi,B13,B14,B15, function() {
initialised = true;
});
}
// ...
setInterval(function() {
if (!initialised) return;
sensor.trigger();
}, 1000);
Or actually call setInterval from the LCD's connect callback instead.
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.
Do you have the Pico? If that's the case then this has never worked - you always have to either run it from a USB power supply (so there's no actual USB connection) or you need to run a terminal program when you're connected to your PC.
I'm working on fixing it - there is a beta version with it fixed (see the USB HID post) but there are some massive changes to USB, so I want to make sure it works fine before I release it.
Also: there is a bit of a problem with your code. You can end up calling
g.flip()
before (or while) the LCD is initialising, which can stop it working. Either try:Or actually call
setInterval
from the LCD'sconnect
callback instead.