You are reading a single comment by @user63099 and its replies. Click here to read the full conversation.
  • Thanks for you help @Wilberforce it now works! It worked on direct upload in the beginning, then I figured out the pin setup via dump() and now I got it working with the following code:

    var DISPLAY_CONTRAST = 0.49;
    var LINE_HEIGHT = 6;
    
    digitalWrite(D2, 0);
    digitalWrite(D4, 0);
    digitalWrite(D5, 0);
    pinMode(D0, "input_pullup");
    pinMode(D12, "input_pullup");
    pinMode(D13, "input_pullup");
    pinMode(D14, "input_pullup");
    digitalWrite(D15, 0);
    
    function drawText(oDisplay, aText, iX, iLineHeight) {
      aText.forEach(function (sLine, iIdx) {
        oDisplay.drawString(sLine, iX, iLineHeight * iIdx); 
      });
    }
    
    function begin () {
      SPI1.setup({ sck:D14, mosi:D13 });
      var g = require("PCD8544").connect(SPI1,
        D4 /* RS / DC */,
        D15 /* CS / CE */, 
        D5 /*RST*/, function() {
    
        g.clear();
        g.setContrast(DISPLAY_CONTRAST);
        g.setRotation(2); //Flip display 180
        drawText(g, [
          "Line 1",
          "Line 2",
          "Line 3",
          "Line 4",
          "Line 5",
          "Line 6",
          "Line 7",
          "Line 8"
        ], 0, LINE_HEIGHT);
        g.drawLine(30, 0, 84,48);
        g.drawLine(30, 48, 84, 0);
        g.flip();
    
      });
    }
    
    E.on("init", begin);
    save();
    

    It looks amazing! so thanks again for your help!

About

Avatar for user63099 @user63099 started