Make sure the light does not flash on before gradually turning on
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
d38989ff54
commit
ffec84eda2
5
main.go
5
main.go
|
@ -198,7 +198,7 @@ func main() {
|
||||||
ticker := time.NewTicker(time.Second)
|
ticker := time.NewTicker(time.Second)
|
||||||
ticker.Stop()
|
ticker.Stop()
|
||||||
|
|
||||||
var brightness uint8 = 0
|
var brightness uint8 = 1
|
||||||
|
|
||||||
// Event loop
|
// Event loop
|
||||||
events:
|
events:
|
||||||
|
@ -241,6 +241,7 @@ events:
|
||||||
fmt.Println("\tGradually turning on lights in the living room")
|
fmt.Println("\tGradually turning on lights in the living room")
|
||||||
// Start the ticker to gradually turn on the living room lights
|
// Start the ticker to gradually turn on the living room lights
|
||||||
ticker.Reset(1200 * time.Millisecond)
|
ticker.Reset(1200 * time.Millisecond)
|
||||||
|
livingRoom.Bri(brightness)
|
||||||
livingRoom.Ct(Temperature)
|
livingRoom.Ct(Temperature)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -256,7 +257,7 @@ events:
|
||||||
if brightness == 0xff {
|
if brightness == 0xff {
|
||||||
fmt.Println("Lights are now on, stopping ticker")
|
fmt.Println("Lights are now on, stopping ticker")
|
||||||
ticker.Stop()
|
ticker.Stop()
|
||||||
brightness = 0
|
brightness = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
case <-halt:
|
case <-halt:
|
||||||
|
|
Reference in New Issue
Block a user