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

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

Top comments (0)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

👋 Kindness is contagious

Engage with a sea of insights in this enlightening article, highly esteemed within the encouraging DEV Community. Programmers of every skill level are invited to participate and enrich our shared knowledge.

A simple "thank you" can uplift someone's spirits. Express your appreciation in the comments section!

On DEV, sharing knowledge smooths our journey and strengthens our community bonds. Found this useful? A brief thank you to the author can mean a lot.

Okay