- Circuit, Materials and Program
Circuit and materials
- Arduino UNO board
- Protoboard
- LDR
- Buzzer
- 100 ohm resistor
- 4K7 resistor
- 6 wires M/M
This slideshow requires JavaScript.
Code
//THEREMIN
#define LDR 0
#define ZUMBADOR 8
#define SILENCIO 775
#define F_MIN 200
#define F_MAX 1500
int valor_ldr, frecuencia;
void setup() {
}
void loop() {
valor_ldr = analogRead(LDR);
if (valor_ldr <= SILENCIO)
{
frecuencia = map(valor_ldr,0,SILENCIO,F_MIN,F_MAX);
tone(ZUMBADOR,frecuencia);
}
else
{
noTone(ZUMBADOR);
}
}