func dumbTickAffecter(dev *fs.Device) { for _ = range time.NewTicker(time.Second).C { buf := dev.Affect() if buf == nil { println("affecter got empty command") } else { println("affecter got command: ", string(buf)) } } }
func dumbTickSensor(dev *fs.Device) { var id int for _ = range time.NewTicker(time.Second).C { id++ str := strconv.Itoa(id) dev.Sense([]byte(str)) if id == 5 { break } } }