andygeiss/esp32-controller

View on GitHub
timer/timer.go

Summary

Maintainability
A
0 mins
Test Coverage
package timer

import "time"

// Delay pauses the program for the amount of time (in milliseconds) specified as parameter.
// @see: https://www.arduino.cc/reference/en/language/functions/time/delay/
func Delay(ms int) {
    done := make(chan bool)
    go func(ms int) {
        time.Sleep(time.Millisecond * time.Duration(ms))
        done <- true
    }(ms)
    select {
    case <-done:
    }
}