Arduino Polska Forum
Projekt klawiszy fortepianowych oparty o Arduino i LCD - Wersja do druku

+- Arduino Polska Forum (https://forum.arduinopolska.pl)
+-- Dział: Inne (https://forum.arduinopolska.pl/dzial-inne)
+--- Dział: Projekty Arduino'wców (https://forum.arduinopolska.pl/dzial-projekty-arduino-wc%C3%B3w)
+--- Wątek: Projekt klawiszy fortepianowych oparty o Arduino i LCD (/watek-projekt-klawiszy-fortepianowych-oparty-o-arduino-i-lcd)



Projekt klawiszy fortepianowych oparty o Arduino i LCD - spikeli - 19-10-2021

Ten projekt wykorzystuje szeregowy ekran dotykowy STVI056WT-01 z płytą sterującą arduino LY-F2 design, główne akcesoria są następujące.

1, seryjny ekran dotykowy 5.6" i płyta adaptera STONE V1.2.
2, głośnik pudełko prezent.
3, LY-F2 płytka rozwojowa.

Idea projektu

Seryjny ekran posiada klawisze fortepianu, zwraca różne wartości klawiszy, port szeregowy powiadamia arduino dekodowania, płyta rozwojowa arduino używa ton instrukcji (), wyjścia odpowiedni ton klucza.

Projekt GUI

[attachment=1156]

Połączenie

[attachment=1157]

kod

Kod:
int inDelay = 0;
String inString = ""; // String buffer
int ipage = 2;
int notes[] = {262, 294, 330, 349, 389, 430, 449, 469, 489, 509}; // Pronunciation frequency array table!

void setup()
{
   Serial.begin(9600); // Open serial communication function wait for serial port to open, baud rate preset.
  while (!Serial) {
    Needed for Leonardo only
  Needed for Leonardo only } }

void loop()
{
  int inChar;
   
  // Read the information sent by the serial port:
  if (Serial.available() > 0) { inChar = Serial.read(); }
 
/* Piano key out music!

if (inChar >= 0x60) { // 0x0060--0x0069 is the Piano key value!
  if (inChar <= 0x69) { 
    tone(8, notes[inChar - 96]); // 0x60 is 96!
    delay(360); // every key is pressed, the music output 0.36s!
noTone(8); // close output!
/* Too, Can write sampe: 
    Tone(8,notes[inChar - 96],360);
*/
  } 
}}

demo wideo