package main
import (
"os"
"time"
"gobot.io/x/gobot"
"gobot.io/x/gobot/drivers/gpio"
"gobot.io/x/gobot/platforms/firmata"
)
func main() {
firmataAdaptor := firmata.NewAdaptor(os.Args[1])
aip1640 := gpio.NewAIP1640Driver(firmataAdaptor, "14", "13")
smiles := [3][8]byte{
{0x3C, 0x42, 0xA5, 0x81, 0xA5, 0x99, 0x42, 0x3C},
{0x3C, 0x42, 0xA5, 0x81, 0xBD, 0x81, 0x42, 0x3C},
{0x3C, 0x42, 0xA5, 0x81, 0x99, 0xA5, 0x42, 0x3C},
}
s := 0
work := func() {
aip1640.Clear()
gobot.Every(600*time.Millisecond, func() {
aip1640.DrawMatrix(smiles[s])
aip1640.Display()
s++
if s > 2 {
s = 0
}
})
}
robot := gobot.NewRobot("aip1640Bot",
[]gobot.Connection{firmataAdaptor},
[]gobot.Device{aip1640},
work,
)
robot.Start()
}