Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
25
Task/Metronome/Go/metronome.go
Normal file
25
Task/Metronome/Go/metronome.go
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"time"
|
||||
)
|
||||
|
||||
func main() {
|
||||
var bpm = 72.0 // Beats Per Minute
|
||||
var bpb = 4 // Beats Per Bar
|
||||
|
||||
d := time.Duration(float64(time.Minute) / bpm)
|
||||
fmt.Println("Delay:", d)
|
||||
t := time.NewTicker(d)
|
||||
i := 1
|
||||
for _ = range t.C {
|
||||
i--
|
||||
if i == 0 {
|
||||
i = bpb
|
||||
fmt.Printf("\nTICK ")
|
||||
} else {
|
||||
fmt.Printf("tick ")
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue