I've managed to hack my way to a solution for my project, but just hoping for some guidance from experts if this is the best way to do this. This is my first experience with microcontrollers and serial communication.
I have an Espruino Pico with a BME280 attached, connected to a host computer via USB.
I'm looking for a stable/energy efficient solution where I can run Node.js on the host, and grab sensor values from the Pico once a minute (currently 5 seconds while testing).
Code on the Pico:
var i2c = new I2C();
i2c.setup({ scl: B6, sda: B7 });
var bme = require("BME280").connect(i2c);
I also tried using the espruino node package like this:
var esp = require("espruino");
const PORT = '/dev/tty.usbmodem00000000001A1'
esp.expr(PORT, 'bme.getData()', console.log);
Which does eventually return the sensor values, but it spams the log with 100+ lines output (too many to copy/paste here!) and the process fails to exit, something to do with Noble scanning.
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.
Hello,
I've managed to hack my way to a solution for my project, but just hoping for some guidance from experts if this is the best way to do this. This is my first experience with microcontrollers and serial communication.
I have an Espruino Pico with a BME280 attached, connected to a host computer via USB.
I'm looking for a stable/energy efficient solution where I can run Node.js on the host, and grab sensor values from the Pico once a minute (currently 5 seconds while testing).
Code on the Pico:
Currently my best try on the Node.js code:
I also tried using the espruino node package like this:
Which does eventually return the sensor values, but it spams the log with 100+ lines output (too many to copy/paste here!) and the process fails to exit, something to do with Noble scanning.
Is there a better approach? Thanks for your help.