Add Driver channel for events
This commit is contained in:
parent
dbc602d5bd
commit
d05268feb2
|
@ -7,6 +7,7 @@ type Driver struct {
|
||||||
Pin string
|
Pin string
|
||||||
Name string
|
Name string
|
||||||
Params map[string]string
|
Params map[string]string
|
||||||
|
Events map[string]chan interface{}
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewDriver(d Driver) Driver {
|
func NewDriver(d Driver) Driver {
|
||||||
|
|
7
gobot.go
7
gobot.go
|
@ -27,3 +27,10 @@ func Random(min int, max int) int {
|
||||||
rand.Seed(time.Now().UTC().UnixNano())
|
rand.Seed(time.Now().UTC().UnixNano())
|
||||||
return rand.Intn(max - min) + min
|
return rand.Intn(max - min) + min
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func On(cs chan interface{}) interface{}{
|
||||||
|
for s := range cs {
|
||||||
|
return s
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue