27 lines
566 B
C++
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);
|
|
}
|