• Witaj na Forum Arduino Polska! Zapraszamy do rejestracji!
  • Znajdziesz tutaj wiele informacji na temat hardware / software.
Witaj! Logowanie Rejestracja


Ocena wątku:
  • 0 głosów - średnia: 0
  • 1
  • 2
  • 3
  • 4
  • 5
Projekt klawiszy fortepianowych oparty o Arduino i LCD
#1
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

   

Połączenie

   

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

 
Odpowiedź
  


Skocz do:


Przeglądający: 2 gości