# Homework

จงออกแบบ [Metronome](https://www.google.com/search?q=metronome\&rlz=1C1CHBF_enTH783TH783\&oq=Metron\&aqs=chrome.1.69i57j69i59.9118j0j1&{google:bookmarkBarPinned}sourceid=chrome&{google:instantExtendedEnabledParameter}{google:omniboxStartMarginParameter}ie=UTF-8) ที่สามารถปรับค่า BPM ได้ตั้งแต่ 40 -100 BPM โดยใช้สัญญาณ clock ที่ความถี่ 100 Hz

-hint code-

```
const int input = 12; // This is where the input is fed.
int pulse = 0; // Variable for saving pulses count.
int var = 0;

void setup(){
  pinMode(input, INPUT);
 
  Serial.begin(9600);
}

void loop(){ 
  if(digitalRead(input) > var)
  {
    var = 1;
    pulse++;   
    Serial.println(pulse);
    //Serial.print(F(" pulse"));

    // Put an "s" if the amount of pulses is greater than 1.
    if(pulse > 1) {Serial.print(F("s"));}
   
   // Serial.println(F(" detected."));
  }
 
  if(digitalRead(input) == 0) {var = 0;}
 
}
```
