forked from hybridgroup/gobot
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
up2: correct i2c default bus information to match correct values
Signed-off-by: Ron Evans <[email protected]>
- Loading branch information
1 parent
eb0a5ff
commit 90d6f4b
Showing
3 changed files
with
56 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// +build example | ||
// | ||
// Do not build by default. | ||
|
||
package main | ||
|
||
import ( | ||
"time" | ||
|
||
"gobot.io/x/gobot" | ||
"gobot.io/x/gobot/drivers/i2c" | ||
"gobot.io/x/gobot/platforms/upboard/up2" | ||
) | ||
|
||
func main() { | ||
board := up2.NewAdaptor() | ||
screen := i2c.NewGroveLcdDriver(board) | ||
|
||
work := func() { | ||
screen.Write("hello") | ||
|
||
screen.SetRGB(255, 0, 0) | ||
|
||
gobot.After(5*time.Second, func() { | ||
screen.Clear() | ||
screen.Home() | ||
screen.SetRGB(0, 255, 0) | ||
// set a custom character in the first position | ||
screen.SetCustomChar(0, i2c.CustomLCDChars["smiley"]) | ||
// add the custom character at the end of the string | ||
screen.Write("goodbye\nhave a nice day " + string(byte(0))) | ||
gobot.Every(500*time.Millisecond, func() { | ||
screen.Scroll(false) | ||
}) | ||
}) | ||
|
||
screen.Home() | ||
time.Sleep(1 * time.Second) | ||
screen.SetRGB(0, 0, 255) | ||
} | ||
|
||
robot := gobot.NewRobot("screenBot", | ||
[]gobot.Connection{board}, | ||
[]gobot.Device{screen}, | ||
work, | ||
) | ||
|
||
robot.Start() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters