Instructables

Arduino Light Instrument

Arduino Light Instrument

This project creates an instrument that’s pitch is determined by the light level. Move your hand over the
light or air strum over it at different heights to block more or less light creating different pitches.

Components Needed:

1x Breadboard
1x Arduino
2x LDRs
2x 100 or 220 Ohm Resistor
2x 10K Resistors
2x Speakers or Piezo Buzzers
Wires

Components can be found at http://egrobotics.com/store/
This Project uses and Arduino Board and LDR Add-on Kit

www.EGRobotics.com

The Code:

void setup() {
}
void loop() {
int sensorReading = analogRead(A0);
int sensorReading1 = analogRead(A1);
int thisPitch1 = map(sensorReading, 400, 1000, 120, 1500);
tone(10, thisPitch1, 10); // change the last value to change how long the speaker holds it's tone for.
delay(100); // Change delay time for different timing, but don't go under tone duration of 10.
int thisPitch2 = map(sensorReading1, 400, 1000, 120, 1500);
tone(11, thisPitch2, 10);
delay(100);
}

Video:


Go to www.instructables.com/member/EGRobotics/ for more fun projects!