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

45 lines
1.0 KiB
Markdown

## Parlantes, Buzzers
- [2 potenciometros y 2 parlantes](#2-pots-2-speakers)
- [ejm. Graduación](./graduacion/graduacion.ino)
- [ejm. midi-to-arduino](./midi_to_ino/midi_to_ino.ino)
- [ejm. Mario1](./mario1/mario1.ino)
- [ejm. Mario2](./mario2/mario2.ino)
- [ejm. Mario3](./mario3/mario3.ino)
- [ejm. Mario4](./mario4/mario4.ino)
- [ejm. himno](./himno/himno.ino)
## 2 pots 2 speakers
Control de tiempo y tono
```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);
}
```
[Descargar](./stereo_2pots_2spkr/stereo_2pots_2spkr.ino)