You are reading a single comment by @user54499 and its replies. Click here to read the full conversation.
  • Huh! g.setFontVector() used to work - I remember someone using it to get 2 digits to fill a PCD8544 with the temperature...

  • unless im doing somthing wrong it no workie. Heres the code:

    I2C1.setup({scl:B6,sda:B7});
    
    
    var text ="temp";
    var fontsize =2;
    
    function getTemp()
    {
      var bmp = require("BMP085").connect(I2C1);
      if (!bmp)
      {
        console.log("bmp failed to init");
        return null;
      }
      bmp.getPressure(function(d) {
      text = "" + d.temperature + " C";
      });
      
    }
    
    function showTemp()
    {
      //require("Font8x12").add(Graphics);
      var g = require("SSD1306").connect(I2C1);
        if (!g)
      {
        console.log("g failed to init");
        return null;
      }
      g.clear();
      g.setColor(255,255,255);
      g.setFontVector(fontsize);
      //g.setFont8x12();
      g.drawString("Temperature: ",0,0);
      g.drawString(text,0,20);
      g.flip(); 
    
    }
    
    function onInit(){
    setInterval(function(){
        getTemp();
        showTemp();
     },1000);
    }
    

    if i increase the fontsize variable beyond 4 it freezes up (sometimes loops a couple of times) seems like a leak or overflow somewhere.

About

Avatar for user54499 @user54499 started