martes, 11 de marzo de 2025

Piano

 

// C++ code
//
/*
  Keyboard
asncfjdsajklfs
  Plays a pitch that changes based on a changing
  input circuit:
  * 3 pushbuttons from +5V to analog in 0 through
  3
  * 3 10K resistors from analog in 0 through 3 to
  ground
  * 8-ohm speaker on digital pin 8
*/

//fsdfs
/*
dsada
asdf
asd
as
d
*/


int pos = 0;
void setup()
{
  pinMode(A0, INPUT);
  pinMode(8, OUTPUT);
  pinMode(A1, INPUT);
  pinMode(A2, INPUT);
}

void loop()
{
  // if button press on A0 is detected
  if (digitalRead(A0) == HIGH) {
    tone(8, 440, 100); // play tone 57 (A4 = 440 Hz)
  }
  // if button press on A1 is detected
  if (digitalRead(A1) == HIGH) {
    tone(8, 494, 100); // play tone 59 (B4 = 494 Hz)
  }
  // if button press on A0 is detected
  if (digitalRead(A2) == HIGH) {//low
    tone(8, 523, 100); // play tone 60 (C5 = 523 Hz)
  }
  delay(10); // Delay a little bit to improve simulation performance
}

Share:

Vistas a la página totales

Buscar este blog

Con tecnología de Blogger.

Translate

Texto alrededor de Imagen

PASO A PASO: Colocar texto detrás de una imagen en GIMP Abrir GIMP. Importar la imagen principal Ir a Archivo → Abrir y elegir una...

Formulario de contacto

Nombre

Correo electrónico *

Mensaje *

Formulario de contacto

Nombre

Correo electrónico *

Mensaje *