コード例 #1
0
func initTestInfrastructure() {
	queue := make(chan string, 1)
	d = initTestFurbyDriver(newGpioTestAdaptor("adaptor"), queue)
	a := audio.NewAudioDriver(audio.NewAudioAdaptor("conn"), "dev", queue)
	a.Start()
}
コード例 #2
0
This application is a tool to generate the needed files
to quickly create a Cobra application.`,
	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("furbyBot called")

		gbot := gobot.NewGobot()
		api.NewAPI(gbot).Start()

		r := raspi.NewRaspiAdaptor("raspi")
		audioAdaptor := audio.NewAudioAdaptor("sound")
		jenkinsAdaptor := jenkinsconnect.NewJenkinsconnectAdaptor("jenkins")

		// Set up asynchronous channel - if we get more than 3 sounds being played in a row, something's up
		csoundFiles := make(chan string, 3)
		furby := furby.NewFurbyDriver(r, "furby", "16", csoundFiles)
		audioDriver := audio.NewAudioDriver(audioAdaptor, "sounds", csoundFiles)
		jenkinsDriver := jenkinsconnect.NewJenkinsconnectDriver(jenkinsAdaptor, "jenkins-command")

		screen := i2c.NewGroveLcdDriver(r, "screen")
		work := func() {

			screen.Clear()
			screen.Home()
			furby.On()

			screen.SetRGB(255, 255, 255)

			if err := screen.Write("Furby say hi!!"); err != nil {
				log.Fatal(err)
			}
コード例 #3
0
ファイル: ledOn.go プロジェクト: colemanserious/furby-gobot
This application is a tool to generate the needed files
to quickly create a Cobra application.`,
	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("ledOn called")

		gbot := gobot.NewGobot()
		api.NewAPI(gbot).Start()

		r := raspi.NewRaspiAdaptor("raspi")
		audioAdaptor := audio.NewAudioAdaptor("sound")

		// Note: see issue #250 in Gobot repo: the pin listed here is NOT the GPIO pin itself, but the pin #.
		// Gobot maps the pin to the GPIO pin
		led := gpio.NewLedDriver(r, "led", "33")
		//led := gpio.NewLedDriver(r, "led", "16")
		audioDriver := audio.NewAudioDriver(audioAdaptor, "sounds", nil)

		work := func() {

			gobot.Every(5*time.Second, func() {
				led.Toggle()
				audioDriver.Sound("resources/foo.wav")
			})

		}

		robot := gobot.NewRobot("furbyBot",
			[]gobot.Connection{r, audioAdaptor},
			[]gobot.Device{led, audioDriver},
			work,
		)