From d05268feb2544eda69ec3f3294a2cc7802f0c7e3 Mon Sep 17 00:00:00 2001 From: Adrian Zankich Date: Mon, 28 Oct 2013 20:26:05 -0700 Subject: [PATCH] Add Driver channel for events --- driver.go | 1 + gobot.go | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/driver.go b/driver.go index ac014c82..8b76c6c3 100644 --- a/driver.go +++ b/driver.go @@ -7,6 +7,7 @@ type Driver struct { Pin string Name string Params map[string]string + Events map[string]chan interface{} } func NewDriver(d Driver) Driver { diff --git a/gobot.go b/gobot.go index a956f9dd..a027f2a0 100644 --- a/gobot.go +++ b/gobot.go @@ -26,4 +26,11 @@ func After(t string, f func()) { func Random(min int, max int) int { rand.Seed(time.Now().UTC().UnixNano()) return rand.Intn(max - min) + min -} \ No newline at end of file +} + +func On(cs chan interface{}) interface{}{ + for s := range cs { + return s + } + return nil +}