Laser Harp – Schematic

The fundamental principle behind the laser harp is that a laser shines on a photoresistor making the resistance in the photoresistor close to 0 ohm, and when the a finger is blocking the laser from making contact with the photoresistor, the resistance goes to almost 200k ohm. By using the photoresistors as pulldown resistors in parallel with another set of resistors, the voltage divider rule can be applied to determine what the voltage values will be when the laser is broken. High and low voltages can be sent to the Atmega328p to determine when to play a note.

Continue reading Laser Harp – Schematic

Laser Harp-Code Snippet

This snippet of code reads the pins on PORTD. If a pin on PORTD is high, “data” will be larger than 0 and will get stuck in the while loop until the pins on PORTD are low again.  Before entering the loop, global interrupts are enabled which allows the interrupt that generates the tone to be called. Then after all pins on PORTD are low, global interrupts are disabled and the program continues. This is used so that a constant tone will be played for however long a laser is blocked.