|
|
||
|---|---|---|
| .gitignore | ||
| diagram.jpg | ||
| example--fill-display-program.txt | ||
| readme.md | ||
| square-wave-from-binary.js | ||
readme.md
Create square wave patterns from binary strings
This script turns a binary string into a square-wave pattern.
It is intended for creating embroidery patterns based on programs for my paper computer.
The output is formatted as if the data is being sent over an 8-bit data bus — see the reference image below.
Use
./square-wave-from-binary.js bin.txt
The input must be a text file containing nothing but 0s and 1s (no spaces, newlines, etc). It must be an even number of 8-bit bytes in length.
Example output
01234567 01234567 01234567 01234567
▄▀▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄ ▄▀▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄
▄▀▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄ ▄▀▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄
▄▀▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄ ▄▀▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄
▄▀▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄ ▄▀▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄
▄▀▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄ ▄▀▄▄▄▄▄▄ ▀▄▀▄▄▄▄▄
▄▀▀▄▀▄▀▄ ▀▄▀▄▄▄▄▄ ▄▀▀▄▀▄▀▄ ▄▄▄▄▄▄▄▄
▀▀▄▄▄▄▄▄ ▀▄▀▄▀▄▄▄ ▀▀▀▄▀▄▀▄ ▄▄▄▄▄▄▄▄
▀▄▀▀▀▀▀▀ ▀▀▀▀▀▀▀▄ ▀▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄
01234567 01234567 01234567 01234567
Format reference image
(From Nuts and Volts.)
