I took the code from someone who had made an EAS (Etch-A-Sketch) that drew random lines, then learnt from there (his code taught me how to drive steppers and how to use case statements).
It's all actually rather simple. The hardest part is defining each numerical digit in code as each EAS is slightly different. For example, when you turn an EAS knob left the "cursor" on the EAS goes left. You could measure this, and quickly write the code that "-1600" steps of the stepper motor draws 2cm of line on the EAS in the left direction.
You would then assume that "+1600" steps would give 2cm of line on the EAS in the right direction, but it won't. You'll probably get around 1cm. This is because the EAS is an "analogue" device with it's own analogue foibles. You'll notice that when you turn a knob in one direction, and then change direction, the drawing stylus will lag behind as slack in the internal mechanisms is taken up.
The exact distance each EAS knob moves the stylus/cursor on the EAS is dependent on what it last did! i.e. if the EAS just moved up, then the next move to the right will be different than if it just moved left. etc etc.
This means each number/digit has to be calculated manually. It was a lot of work. Not difficult, but it required patience. I did it over several evenings. You will notice the digits 8,9 and 0 are not so pretty as these were the last ones to do and I had lost my patience by then! You can fine tune them easily :-)
To work out the numbers I printed 0-9 in a "digital" font and then cut the numbers out. I then stuck them on the EAS and "drew" around them with the EAS test code (more on that later).