| You've probably seen dev-board demos that show you how to flash LEDs. Well, we decided to produce similar demo using WIRING programming language, AVR ATMega644 M-32 dev-board and Sparkfun laser module instead of the LED. One thing is for sure - lasers are fun. This particular laser module can reach walls as far as fifteen meters away and it doesn't seem to be the limit. The laser module requires POWER (RED), GROUND (BLACK), and TTL control (WHITE) wire connections. For the setup we used M-32 dev-board that comes with on board power and ground pins that we used to power the laser . TTL control line was connected to B0 pin of ATMega644 micro. Here is how SPF laser module connector looked like after we were done hooking up the wires.
The program logic is pretty simple.The program sets pin to HIGH then goes to sleep for one second then sets pin to LOW and goes to sleep again. This will be repeated in the infinite loop. We used one of the WIRING/Arduino blinking LED examples to produce blinking laser demo.
This is how the source looks like.
int laserPin = 8; // Laser connected to digital pin 8 - PB0 of M32
void setup() // run once, when the sketch starts { pinMode(laserPin, OUTPUT); // sets the digital pin as output }
void loop() // run over and over again { digitalWrite(laserPin, HIGH); // sets the Laser on delay(1000); // waits for a second digitalWrite(laserPin, LOW); // sets the Laser off delay(1000); // waits for a second }
Here is the ZIP with source code and HEX file for ATMega644 with clock speed of 8MHz. This how the result looks like once you get everything together and working :)  |