- En el Menú de Herramientas, seleccione "placa" y allí busque la placa "Adafruit Circuit Playground".
- Luego en el menú "herramientas" seleccione "Puerto" y allí verá el circuitPlayground, selecciónelo.
Vamos a crear sonidos con nuestra tarjeta CircuitPlayground
Utilizamos este sintaxis:
CircuitPlayground.playTone (262,500); // NOTA DO
Cambiamos los números para otras notas:
DO 262,500
RE 294,500
MI 330,500
FA 349,500
SOL 392,500
LA 440,500
SI 494,500
DO 523,500 más agudo
Escribimos el siguiente código:
// Copie utilizando el codigo camello (respete las mayúsculas en las palabras)
// CUIDADO CON LAS LLAVES y LOS PARENTESIS
#include <Adafruit_CircuitPlayground.h>
void setup() { //incio del Programa
Serial.begin(9600);
CircuitPlayground.begin();
}
void loop() {//ciclo del Programa
//sonidos
CircuitPlayground.playTone (262,500); delay(50); // DO
CircuitPlayground.playTone (294,500); delay(50); // RE
CircuitPlayground.playTone (330,500); delay(50); // MI
CircuitPlayground.playTone (349,500); delay(50); // FA
CircuitPlayground.playTone (392,500); delay(50); // SOL
CircuitPlayground.playTone (440,500); delay(50); // LA
CircuitPlayground.playTone (494,500); delay(50); // SI
CircuitPlayground.playTone (523,500); delay(50); // DO2
}
Copiando y pegando algunas lineas de código podemos crear melodías sencillas.
Puedes tocar alguna de estas melodías:
ESTRELLITA DÓNDE ESTAS
DO-DO-SOLSOL-LA-LA-SOL
FA-FA-MI-MI-RE-RE-DO
- = - = - = - = - = - = - = - = - =
Arroz con leche
Do Fa La Fa Fa
Do Fa Fa La Sol
La Sib La Sol Fa Mi Mi Do Do Re Mi Mi Fa
= - = - = - = - = - = - = - = - = - =
Título: Noche de paz
Sol La Sol Mi
Sol La Sol Mi
re re Si do do Sol
= - = - = - = - = - = - = - = - = - =
Título: La cucaracha
Do Do Do Fa La
Do Do Do Fa La
Fa Fa Mi Mi Re Re Do
= - = - = - = - = - = - = - = - = - =PROGRAMANDO ESTRELLITA DÓNDE ESTAS
// Copie utilizando el codigo camello (respete las mayusculas en las palabras)
// CUIDADO CON LAS LLAVES y LOS PARENTESIS
#include <Adafruit_CircuitPlayground.h>
void setup() { //incio del Programa
Serial.begin(9600);
CircuitPlayground.begin();
}
void loop() {//ciclo del Programa
//sonidos
CircuitPlayground.playTone (262,500); delay(50); // DO
CircuitPlayground.playTone (262,500); delay(50); // DO
CircuitPlayground.playTone (392,500); delay(50); // SOL
CircuitPlayground.playTone (392,500); delay(50); // SOL
CircuitPlayground.playTone (440,500); delay(50); // LA
CircuitPlayground.playTone (440,500); delay(50); // LA
CircuitPlayground.playTone (392,500); delay(50); // SOL
delay (1000);
CircuitPlayground.playTone (349,500); delay(50); // FA
CircuitPlayground.playTone (349,500); delay(50); // FA
CircuitPlayground.playTone (330,500); delay(50); // MI
CircuitPlayground.playTone (330,500); delay(50); // MI
CircuitPlayground.playTone (294,500); delay(50); // RE
CircuitPlayground.playTone (294,500); delay(50); // RE
CircuitPlayground.playTone (262,500); delay(50); // DO
delay (1000);
}