Theremin


Actually, I wasn't planing on making a theremin, I was exploring the arduino sound capability and kinda drift into it...
This is an easy Saturday project.
You will need :
Arduino - I used the pro mini
Breadboard
220 ohm resistor
A speaker
an Infrared proximity sensor
Explanation

The arduino sens the proximity of the hand and divide it to 15 notes according to the 4th and 5th octave ending with the 6th C to realize what note to play
Then according to where the output Hertz are at the moment it will decrease or increase to match that note.
The Code

int oct [15] = {262, 294, 330, 349, 392, 440, 494, 523, 587, 659, 698, 784, 880, 988, 1047};
int Play = oct [0];
void setup (){ pinMode (5, OUTPUT); pinMode (A1, INPUT); Serial.begin (9600); }
void loop (){ int Hz = constrain (map (analogRead (A1), 100, 500,0, 14), 1, 14); Serial.println (Play); if (Play > oct [Hz]) {Play = Play - 6;} if (Play < oct [Hz]) {Play = Play+6;} tone (5,Play ); // delay (100); }