Created
          November 29, 2017 16:10 
        
      - 
      
- 
        Save xyos/595a80c9df33db8fcbe0e73cece61ae2 to your computer and use it in GitHub Desktop. 
Revisions
- 
        xyos created this gist Nov 29, 2017 .There are no files selected for viewingThis file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,42 @@ let msj = " 000 000 000 000 000 000 000 000 ooo 000 000 000 000 000 000 000 "+ " 0 0 0 0 0 0 0 0 0 0 o o 0 0 0 0 0 0 0 0 0 " + " 000 0 0 000 0 0o0 000 0 ooo 000 0 0 0 000 000 0 0 0 " + " 0 0 0 0 0 0 0 0 0 0 oo 0 0 0 0 0 0 0 0 0 0 " + " 0 0 000 000 000 000 0 0 0 000 o o 000 000 0 0 000 000 0 0 000 "; msj = msj.split("").reverse() var leds = []; for (var i = 0; i < 80 ; i++) { leds.push([0,0,0,0,0]); } for (var i = 0, j = 0, m=0, len = msj.length; i < len; i++) { j = parseInt(i/80); m = i%80; leds[m][j] = msj[i] == " " ? 0 : 1; } flat_leds = [] for (var i=0; i < 80; i++) { for (var j=0; j < 5; j++) { flat_leds.push(leds[i][j]); } } shift_leds = []; for (var i = 0; i < 50 ; i++) { shift_leds.push([0,0,0,0,0,0,0,0]); } for (var i = 0, len = flat_leds.length; i < len; i ++) { var j = parseInt(i/8); var m = i%8; shift_leds[j][m] = flat_leds[i]; } let bin_leds = []; for (const led of shift_leds) { bin_leds.push(parseInt(led.join(""), 2)) } console.log(bin_leds);