You are reading a single comment by @Owen and its replies. Click here to read the full conversation.
  • Hello,
    I have daisy chained two HC959 ICs together and wired them up to 16 LEDs. The code below produces a Nightriders effect with the LEDs running up and down. Everything is working well but I must be doing something wrong as the LED 8 above or below the lit one very quickly flashes on too. This would be coming from the other IC so I think the issuebut not sure how to fix it?

    SPI1.setup({ mosi:B5, sck:B3 });
    var i = 2,
          dir = true;
    function loop() {
      
      SPI1.send(i>>8,B8);
      SPI1.send(i,B8);
      
      if(dir) {
          i = i<<1;
      }
      else {
          i= i>>1;
      }
      
      // Change direction
      if(i >= 25536 || i <= 2) {
          dir = !dir;
      }
    }
    setInterval(loop, 60);
    
About

Avatar for Owen @Owen started