Hi! Glad you got something working! Personally I think there is a tidier way of getting it going though - it's to let the Pico collect the data and push it out itself, then to just listen to the USB serial port for data.
So I'll just use temperature from the chip as anyone can try that - but all you need to do is replace E.getTemperature() with bme.getData():
// push data every 2 seconds
setInterval(function() {
USB.println(E.getTemperature());
}, 2000)
Now you can just do cat /dev/tty.usbmodem00000000001A1 on the host PC and it'll display data.
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.
Hi! Glad you got something working! Personally I think there is a tidier way of getting it going though - it's to let the Pico collect the data and push it out itself, then to just listen to the USB serial port for data.
So I'll just use temperature from the chip as anyone can try that - but all you need to do is replace
E.getTemperature()
withbme.getData()
:Now you can just do
cat /dev/tty.usbmodem00000000001A1
on the host PC and it'll display data.Now you might just be able to open that as a file in Node.js, or potentially you can use child_process(https://nodejs.org/api/child_process.html) to run
cat /dev/tty.usbmodem00000000001A1
and respond when you get data from it: https://nodejs.org/api/child_process.html#child_process_child_process_spawn_command_args_options