apuntes_Arduino/buzzer/stereo_2pots_2spkr/stereo_2pots_2spkr.ino
jp.av.dev 85bf8bb429 proyectos renombrados, reestructuracion
pendientes crear, indexar y linkear readmes
2022-04-04 01:11:04 -04:00

27 lines
566 B
C++

#define pot1 A0
#define pot2 A1
#define pot3 A2
#define pot4 A3
#define spkrL 2
#define spkrR 1
void setup() {
//pinMode(spkrL, OUTPUT);
//pinMode(spkrR, OUTPUT);
}
void loop() {
// tone(pin, frequency, duration)
int duracionL=map(analogRead(pot3), 0, 1023, 10, 1000);
int duracionR=map(analogRead(pot4), 0, 1023, 10, 1000);
int tonoL=map(analogRead(pot1),0, 1023, 60, 5000);
int tonoR=map(analogRead(pot2),0, 1023, 60, 5000);
tone(spkrL, tonoL, duracionL);
delay(duracionL);
tone(spkrR, tonoR, duracionR);
delay(duracionR);
delay(30);
}