Example #1
0
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))
		}
	}
}
Example #2
0
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
		}
	}
}