You are reading a single comment by @DrAzzy and its replies. Click here to read the full conversation.
  • 
    pinMode(A7,"af_opendrain");
    pinMode(A5,"af_opendrain");
    SPI1.setup({sck:A5,mosi:A7,mode:1,order:­"msb"});
    
    anibuff=[];
    anibuff[0]=new Uint8Array([0,0,0,0,0xff,0x00,0x5c,0xb9,­0xff,0x00,0x80,0xff,0xff,0x52,0x5c,0x0a,­0xff,0x51,0x00,0x00,0xff,0x00,0x40,0x80,­0xff,0x01,0x4b,0xa7,0xff,0xff,0xff,0x00]­);
    anibuff[1]=new Uint8Array([0,0,0,0,0xff,0xff,0xff,0x00,­0xff,0x00,0x80,0xff,0xff,0x52,0x5c,0x0a,­0xff,0x51,0x00,0x00,0xff,0x00,0x40,0x80,­0xff,0x01,0x4b,0xa7,0xff,0x00,0x4f,0x4f]­);
    anibuff[2]=new Uint8Array([0,0,0,0,0xff,0x00,0x5c,0xb9,­0xff,0xff,0xff,0x00,0xff,0x52,0x5c,0x0a,­0xff,0x51,0x00,0x00,0xff,0x00,0x40,0x80,­0xff,0x01,0x4b,0xa7,0xff,0x00,0x4f,0x4f]­);
    anibuff[3]=new Uint8Array([0,0,0,0,0xff,0x00,0x5c,0xb9,­0xff,0x00,0x80,0xff,0xff,0xd0,0xd0,0x00,­0xff,0x51,0x00,0x00,0xff,0x00,0x40,0x80,­0xff,0x01,0x4b,0xa7,0xff,0x00,0x4f,0x4f]­);
    anibuff[4]=new Uint8Array([0,0,0,0,0xff,0x00,0x5c,0xb9,­0xff,0x00,0x80,0xff,0xff,0x52,0x5c,0x0a,­0xff,0xff,0xff,0x00,0xff,0x00,0x40,0x80,­0xff,0x01,0x4b,0xa7,0xff,0x00,0x4f,0x4f]­);
    anibuff[5]=new Uint8Array([0,0,0,0,0xff,0x00,0x5c,0xb9,­0xff,0x00,0x80,0xff,0xff,0x52,0x5c,0x0a,­0xff,0x51,0x00,0x00,0xff,0xff,0xff,0x00,­0xff,0x01,0x4b,0xa7,0xff,0x00,0x4f,0x4f]­);
    anibuff[6]=new Uint8Array([0,0,0,0,0xff,0x00,0x5c,0xb9,­0xff,0x00,0x80,0xff,0xff,0x52,0x5c,0x0a,­0xff,0x51,0x00,0x00,0xff,0x00,0x40,0x80,­0xff,0xff,0xff,0x00,0xff,0x00,0x4f,0x4f]­);
    currentframe = 0;
    framecount=7;
    
    function APA102Lite(data){
      SPI1.send(data);
      SPI1.send([0xFF,0xFF,0xFF,0xFF]);
    }
    
    function animate() {
      currentframe++;
      if (currentframe >= framecount) {
        currentframe=0;
      }
      APA102Lite(anibuff[currentframe]);
      timer=setTimeout("animate()",100);
    }
    
    
    
About

Avatar for DrAzzy @DrAzzy started