Step 30: Change the Code!
Note: If you made it to this step without downloading the source code - it's in a zip file attached to Step 26.
Here's a few of the included routines:
Turns laser on.
Turns laser off.
Sends laser to X and Y coordinates. The coordinate system is 256 x 256 - but the real resolution is lower (maybe half) that.
draw_string("STRING", X, Y, COUNT)
Draws a text string at X,Y for COUNT times. Uppercase characters, numbers and some punctuation is supported (see code).
move_scale = X
Sets scaling (font size) used by draw_string. Setting it to 2.8 provides enough room for 5 characters.
marquee("HELLO WORLD", CHARACTERS)
Draws a scrolling marquee CHARACTERS long - text is autoscaled to fit (4 to 7 characters long works best).
Now for a little tutorial - look for this code at around line 90:
//put your laser control code here!
//run the default laser show demo
The Arduino runs any code in this section over and over again. Try changing it to:
move_scale = 2.8; //sets text size
draw_string("LASER", 1, 1, 10);
draw_string("TEST", 1, 1, 10);
marquee("LET'S DRAW A STAR!!!", 5) ;
//draw a star 15 times
for (int loop = 0; loop < 15; loop ++)
There are a bunch of variables you can tweak and a few more routines documented in the code.
Dig in and have fun! If you mess things up - you can always re-download the code and start over.