My next slight mystery (apart from not surviving a reset/power cycle) is that the font has become very ugly. I am not sure at what point this happened, and actually thought it might be the LCD, so replaced. But same effect ...
SPI1.setup({ baud: 1000000, sck:B3, mosi:B5 });
var ow = new OneWire(B13);
var g, temp;
function onInit() {
clearInterval();
temp = require("DS18B20").connect(ow);
g = require("PCD8544").connect(SPI1,B6,B7,B8, function() {
setInterval(onTimer, 500);
});
}
function onTimer() {
// Get the temperature
var t = temp.getTemp();
// Round it to the nearest 0.1
t = Math.round(t*10)/10;
// Now draw!
g.clear();
g.setFontBitmap(); // simple 8x8 font
g.drawString("Temp",2,0);
g.drawLine(0,10,84,10);
g.setFontVector(25); // large font
g.drawString(t, 0, 15);
g.flip(); // copy this to the screen
}
onInit();
Incidentally the default 0,0 for Temp, puts the text off the LHS of the screen slightly, so I changed to 2,0. Changing setFontVector to other numbers has little effect .
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.
My next slight mystery (apart from not surviving a reset/power cycle) is that the font has become very ugly. I am not sure at what point this happened, and actually thought it might be the LCD, so replaced. But same effect ...
Incidentally the default 0,0 for Temp, puts the text off the LHS of the screen slightly, so I changed to 2,0. Changing setFontVector to other numbers has little effect .
Is this to be expected/as intended ?
Pat