Selected Courses on Digital Art-UOWM

16 Νοεμβρίου 2014

ARDUINO07-KEYBOARD INSTRUMENTS

Filed under: ARDUINO,NOTES ON INTERACTIVE ART — admin @ 11:24
int notes[] = {262, 294, 330, 349};
void setup() {
  Serial.begin(9600);
}
void loop() {
  int keyVal = analogRead(A0);
  Serial.println(keyVal);
  if (keyVal == 1023) {
    tone(8, notes[0]);
  }
  else if(keyVal >= 990 && keyVal <= 1010) {
    tone(8, notes[1]);
  }
  else if(keyVal >= 505 && keyVal <= 515) {
    tone(8, notes[2]);
  }
  else if(keyVal >= 5 && keyVal <= 10) {
    tone(8, notes[3]);
  }
  else {
    noTone(8);
  }
}

[youtube https://www.youtube.com/watch?v=KJ_Ie5GfBE0]

Δεν υπάρχουν Σχόλια

No comments yet.

RSS feed for comments on this post.

Sorry, the comment form is closed at this time.

Powered by WordPress

error: Content is protected !!