Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
A Metronome example, developed in Golang. Takes a bpm and count as input.
package main
import (
"fmt"
"log"
"os"
"strconv"
"time"
)
func main() {
bpm, err := strconv.Atoi(os.Args[1])
count, err2 := strconv.Atoi(os.Args[2])
if err != nil || err2 != nil {
log.Fatal(err)
}
times := time.Duration(bpm)
for index := 0; index < count; index++ {
fmt.Println("beep")
time.Sleep(time.Minute / times)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.