DEV Community

Camilly Duarte
Camilly Duarte

Posted on

3

PROJETO ROBÓTICA - Piano Arduino

void setup()
{
  pinMode(3, OUTPUT);

  pinMode(4, INPUT);
  pinMode(5, INPUT);
  pinMode(6, INPUT);
  pinMode(7, INPUT);
  pinMode(8, INPUT);
  pinMode(9, INPUT);
  pinMode(12, INPUT);

  Serial.begin(9600);
}

void loop()
{
  if (digitalRead(4) == HIGH) {
    tone(3, 523, 200); // play tone 131 (B10 = 31609 Hz)
    Serial.println("Si");
  }
  else if (digitalRead(5) == HIGH) {
    tone(3, 440, 200); // play tone 129 (A10 = 28160 Hz)
    Serial.println("La");
  }
  else if (digitalRead(6) == HIGH) {
    tone(3, 392, 200); // play tone 127 (G10 = 25088 Hz)
    Serial.println("Sol");
  }
  else if (digitalRead(7) == HIGH) {
    tone(3, 349, 200); // play tone 125 (F10 = 22351 Hz)
    Serial.println("Fa");
  }
  else if (digitalRead(8) == HIGH) {
    tone(3, 329, 200); // play tone 124 (E10 = 21096 Hz)
    Serial.println("Mi");
  }
  else if (digitalRead(9) == HIGH) {
    tone(3, 294, 200); // play tone 122 (D10 = 18795 Hz)
    Serial.println("Re");
  }
  else if (digitalRead(12) == HIGH) {
    tone(3, 261, 200); // play tone 120 (C10 = 16744 Hz)
    Serial.println("Do");
  }
  else{
    noTone(3);
  }

}

Enter fullscreen mode Exit fullscreen mode

Projeto de robótica realizado pela turma da escola Ctrl Play. A ideia é fazer um piano (semelhante ao real) so que utilizando arduino + alguns componentes como: botões, buzzer e resistores;

Image description

Heroku

Build apps, not infrastructure.

Dealing with servers, hardware, and infrastructure can take up your valuable time. Discover the benefits of Heroku, the PaaS of choice for developers since 2007.

Visit Site

Top comments (0)

Image of Docusign

🛠️ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more