You are reading a single comment by @Gordon and its replies. Click here to read the full conversation.
  • well it runs automatically on connect

    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,B­­15, function() {
       initialised = true;
      });
    }
    
    // ...
    
    setInterval(function() {
      if (!initialised) return;
      sensor.trigger();
    }, 1000); 
    

    Or actually call setInterval from the LCD's connect callback instead.

About

Avatar for Gordon @Gordon started