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:
laser_on()
Turns laser on.
laser_off()
Turns laser off.
sendto (X,Y)
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!
void loop()
{
//run the default laser show demo
demo();
}
The Arduino runs any code in this section over and over again. Try changing it to:
void loop()
{
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 ++)
{
laser_off();
sendto (85,10);
laser_on();
sendto (150,130);
sendto (0,40);
sendto (170,40);
sendto (20,130);
sendto (85,10);
}
}
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.
Remove these ads by
Signing Up





































































Visit Our Store »
Go Pro Today »




Provide a more stable load for the transistors to drive
Reduce back-EMF
The effect is definitely to increase how much the speakers are driven and the quality of the rendering.
I came up with this configuration more by experimenting than anything else.
If you aren't getting good results - I would be sure the resistors you are using are rated to handle the power.
since you basically only drive your speakers with either positive, or zero voltage, you could replace the resistors with a diode. the diode should point its arrow the other way than the normal flow of current through your circuit. that would drain away the back-emf, but not also the driving voltage. i assume you would find that you will have increased the gain of your diy galvos, and possibly need to adjust for that....
i don't have the time or resources to try this out anytime in the near future, but i would sure love if you'd try out my suggestion and tell me about the results.
I actually have things setup using a diodes now - works great - and uses a little less power.
Had to make a few tweaks to some variables to get good results - but this is probably a better setup.
I'm going to add some notes to the project (and parts numbers for diodes / etc.)
http://en.wikipedia.org/wiki/Flyback_diode
turns out diodes (if big enough) can work as well.
going to update the project notees in the next day or so to reflect this option.
if that doesn't help - i would try other speakers
also - are you using the resistors across the speaker leads?
It combones two transistors in one to acheive higher "gain" - this lets it amplify the tiny arduino signal to somehtng powerful enough to move the speaker without additional supporting electronics.
other darlington drivers may work - but I suggest using the tip120's as they are tested and fairly cheap
Well I wonder if you could provide me the complete code for my arduino UNO.
I would be grateful for your help.
Thanks to more
good luck!
-Rich
can you send me please the full code for my arduino ?
henri,
Good luck!
-Rich
i have a error when i program my arduino ,
sketch_mar21a.cpp: In function 'void loop()':
sketch_mar21a:6: error: 'demo' was not declared in this scope
sketch_mar21a.cpp: At global scope:
sketch_mar21a:10: error: 'The' does not name a type
bye,
henri
can you send me the FULL program to put on my arduino ?
please ?
thanks .
From your error - it sounds like you might be just using the code listed in this step - which isn't complete. It's just showing how you can modify the code that's included in step 26.
I would redownload the code attached to step 26 - and try it again.
If that doesn't work - I'd make sure you have the latest Arduino software.
Let me know if this helps or not.
Good luck!
-Rich
can you send me the FULL PROGRAM FOR MY ARDUINO PLEASE ?
thanks you
henri,
I WONDER IF HE GOT THE CLUE !?!?!?
The .pde in the .zip on step 26 complies with 0 errors using arduino IDE v21
Very Nice Instructable,
Keep up the nice work.
Matt