You are reading a single comment by @mattbrailsford and its replies. Click here to read the full conversation.
  • So I've re-flashed as suggested (thanks for step by step guys) which all went well, and have updated the code to as follows:

    var OE = B6;
    var CLK1 = C6;
    var CLK2 = C7;
    var DAT = C8;
    var LAT = C9;
    
    var HIGH = 1;
    var LOW = 0;
    
    pinMode(OE,   'output');
    pinMode(CLK1, 'output');
    pinMode(CLK2, 'output');
    pinMode(DAT,  'output');
    pinMode(LAT,  'output');
    
    var counter = 0;
    var currentRow = 0;
    var image = new Uint8Array(8);
    
    var display = [
      [1,1,1,1,1,1,1,1], 
      [1,1,1,1,1,1,1,1], 
      [1,1,0,0,0,0,0,0], 
      [1,1,1,1,1,1,1,1], 
      [1,1,1,1,1,1,1,1], 
      [1,1,0,0,0,0,0,0], 
      [1,1,1,1,1,1,1,1], 
      [1,1,1,1,1,1,1,1] 
    ];
    
    var S1 = new SPI();
    S1.setup({mosi:DAT, sck:CLK1, mode:3});
    
    var S2 = new SPI();
    S2.setup({mosi:DAT, sck:CLK2, mode:0});
    
    
    function updateDisplay()
    {
      var newImg = new Uint8Array(8);
      for(var j=0; j<8; j++) {
        newImg[j] = 0x00;
        for(var i=0; i<8; i++) {
          newImg[j] <<= 1;
          newImg[j] |= display[j][i];
        }
      }
      if(newImg != image) {
        for(var i=0; i<8; i++){
          image[i] = newImg[i];
        }
      }
    }
    
    function updateRow()
    {
    	if(counter==8) {
    		counter = 0;
    		currentRow = 0x80;
    	}
    	writeToRegister(0);
    	writeToDriver(image[counter]);
    	writeToRegister(currentRow);
    	currentRow >>= 1;
    	counter++;
    }
    
    function writeToDriver(dataOut)
    {
    	digitalWrite(OE, HIGH);
    	S1.send(dataOut);
    	digitalWrite(LAT, HIGH);
    	digitalWrite(LAT, LOW);
    	digitalWrite(OE, LOW);
    }
    
    function writeToRegister(dataOut)
    {
        S2.send(dataOut, LAT);
    	digitalWrite(LAT, LOW);
    }
    
    updateDisplay();
    
    setInterval(function(){
      updateRow();
    }, 1000);
    

    (Just put a 1s interval for now to test) but I get an error in the terminal window:

    INTERNAL ERROR: Timeout on SPI TX
    INTERNAL ERROR: Timeout on SPI TX
    INTERNAL ERROR: Timeout on SPI RX
    at line 2 col 25
        S2.send(dataOut, LAT);
                             ^
    in function "writeToRegister" called from line 6 col 22
    in function "updateRow" called from line 2 col 13
    in function called from system
    ERROR: Error processing interval - removing it.
    Execution Interrupted during event processing.
    

    @DrAzzy I'd love to see your write up if you get that working.

About