   pinMode(lTom, INPUT);
   pinMode(crash, INPUT);
  
-  //  setup serial
 }
 
 void loop()
 {
-  valBass = digitalRead(bass);// read the input pin
-  valRide = digitalRead(hHat);// read the input pin
-  valCrash = digitalRead(hTom);// read the input pin
-  valmTom = digitalRead(mTom);// read the input pin
-  vallTom = digitalRead(ride);// read the input pin
-  valhHat = digitalRead(snare);// read the input pin
-  valSnare = digitalRead(lTom);// read the input pin
-  valhTom = digitalRead(crash);// read the input pin
+  valSnare = digitalRead(lTom);// read button 1 state
+  valCrash = digitalRead(hTom);// read button 2 state
+  valRide = digitalRead(hHat);// read button 3 state
+  valhHat = digitalRead(snare);// read button 4 state
+  valBass = digitalRead(bass);// read button 5 state
+  vallTom = digitalRead(ride);// read button 6 state
+  valmTom = digitalRead(mTom);// read button 7 state
+  valhTom = digitalRead(crash);// read button 8 state
 
-  if (valBass == 1)//bt5
+  // Keyboard state for button 1
+  if (valSnare == 1)
   {
-    Keyboard.press('g');
-  }
-  else{
-    Keyboard.release('g');
-  }
-  
-  if (valhHat == 1)//bt4
-  {
-    Keyboard.press('f');
+    Keyboard.press('a');        // do
   }
    else{
-    Keyboard.release('f');
+    Keyboard.release('a');      // Since Arduino doesn't support anti-ghosting, each key must have a release condition
   }
-  
-  if (valhTom == 1)//bt8
+ 
+  // Keyboard state for button 2
+  if (valCrash == 1)
   {
-    Keyboard.press('k');
+    Keyboard.press('s');        // re
   }
    else{
-    Keyboard.release('k');
+    Keyboard.release('s');
   }
-  if (valmTom == 1)//bt7
+ 
+  // Keyboard state for button 3
+  if (valRide == 1)
   {
-    Keyboard.press('j');
-  }
-   else{
-    Keyboard.release('j');
-  }
-  
-  if (valRide == 1)//bt3
-  {
-    Keyboard.press('d');
+    Keyboard.press('d');        // mi
   }
    else{
     Keyboard.release('d');
   }
   
-  if (valSnare == 1)//bt1
+  // Keyboard state for button 4
+  if (valhHat == 1)
   {
-    Keyboard.press('a');
+    Keyboard.press('f');        // fa
   }
    else{
-    Keyboard.release('a');
+    Keyboard.release('f');
   }
-  
-  if (vallTom == 1)//bt6
+ 
+  // Keyboard state for button 5
+  if (valBass == 1)
   {
-    Keyboard.press('h');
+    Keyboard.press('g');        // sol
+  }
+  else{
+    Keyboard.release('g');
+  }
+ 
+  // Keyboard state for button 6
+  if (vallTom == 1)
+  {
+    Keyboard.press('h');        // la
   }
    else{
     Keyboard.release('h');
   }
   
-  if (valCrash == 1)//bt2
+  // Keyboard state for button 7
+  if (valmTom == 1)
   {
-    Keyboard.press('s');
+    Keyboard.press('j');        // ti
   }
    else{
-    Keyboard.release('s');
+    Keyboard.release('j');
+  }
+ 
+  // Keyboard state for button 8
+  if (valhTom == 1)
+  {
+    Keyboard.press('k');        // do
+  }
+   else{
+    Keyboard.release('k');
   }
   
-  delay(10);
+  delay(10); // Small delay needed to prevent Arduino from potentially freezing
 
 }

int vallTom = 0;
int valCrash = 0;

// variable to store the value read
 
void setup()
{
  Serial.begin(9600);
  pinMode(bass, INPUT); 
  pinMode(hHat, INPUT);
  pinMode(hTom, INPUT);

int lTom = 8;
int crash = 9;

// Initiate variables for recording input states
int valBass = 0;
int valhHat = 0;
int valhTom = 0;
