Need help with laser harp code

I have built somewhat of a harp with laser pointer beams directed at mini photocells and hooked them up to a spark core, I am trying to turn it into a midi device that is activated by the breaking of the beams but am not sure where to start for coding as I have not done much programming. Any help would be greatly appreciated!!

Try looking at some Arduino examples. They should be mostly code compatible, but more importantly, they’ll give you an idea of what it’s going to look like. I’m sure there are some Arduino Laser harps out there, which you can get some inspiration from.

By midi do you mean like a sound output? search for RTTTL you should see a few results to give you a leg up on the sound output side of things. I use it on my doorbell when someone presses the button it plays a little tune

As for the Photcell there is a good Adafruit tutorial here

Change the pins to suit (instead of pin 0 try A0 for the LDR and instead of 11 try A1 for the LED in the first example)

And you will need to change the 1023 in this line to 4095… because the spark is better than an arduino :stuck_out_tongue:

LEDbrightness = map(photocellReading, 0, 1023, 0, 255);
2 Likes