here's the code btw - very quick and dirty as i was experimenting late at night :)
var temperatura; var spi = new SPI(); spi.setup({mosi:D2, miso:D1, sck:D27}); SPI1.setup({ sck:D31, mosi:D30, order: "lsb", baud: 4000000 }); //SPI1.setup({ miso:D1, sck:D27, baud:60000 }); var sensor=require("MAX31855").connect(spi,D2); var temper= sensor.getTemp(); console.log(temper); console.log(temper.temp); var g = require("MemoryLCD").connect(SPI1, D29/*SCS*/, D28/*EXTCOMIN*/, 144/*width*/, 168/*height*/); function onTimer() { temper= sensor.getTemp(); temperatura= temper.temp.toFixed(1); g.clear(); g.setFontVector(50); // g.drawString("Hello WORLD",30,70); g.drawLine(0,30,g.getWidth(),30); g.drawLine(0,31,g.getWidth(),31); g.drawLine(0,137,g.getWidth(),137); g.drawLine(0,138,g.getWidth(),138); g.drawString(temperatura, 0, 55); g.setFontVector(20); g.drawString("Battery: "+Puck.getBatteryPercentage(), 0, 143); g.flip(); } // Update temperature every 2 seconds setInterval(onTimer,10000); // Update temperature immediately onTimer();
@user92397 started
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.
here's the code btw - very quick and dirty as i was experimenting late at night :)