Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Teaching a Vaccum Robot to be a Webradio in Go ...

GoDays
January 30, 2019

Teaching a Vaccum Robot to be a Webradio in Go - Tobias Kohlbau, myOpenFactory

Teaching a Vaccum Robot to be a Webradio in Go - Tobias Kohlbau, myOpenFactory

GoDays

January 30, 2019
Tweet

More Decks by GoDays

Other Decks in Technology

Transcript

  1. TEACHING A VACCUM TEACHING A VACCUM ROBOT TO BE A

    WEBRADIO ROBOT TO BE A WEBRADIO IN GO IN GO
  2. ABOUT ME ABOUT ME Tobias Kohlbau So ware Developer @

    Twitter: GitHub: myOpenFactory GmbH myOpenFactory GmbH @toktech @toktech tobiaskohlbau tobiaskohlbau
  3. HACKABLE HACKABLE Ubuntu OS powered by ARM v7 Processor Root

    access without opening the device Cleaning Robot Hacking bit.ly/2VI5aTr bit.ly/2VI5aTr
  4. package main import ( "io" "log" "os" "github.com/hajimehoshi/go-mp3" "github.com/hajimehoshi/oto" )

    func main() { res, err := http.Get("https://static.kohlbau.de/audio.mp3") if err != nil { log.Fatal(err) } decoder, err := mp3.NewDecoder(res.Body) if err != nil { log.Fatal(err) } defer decoder.Close() player, err := oto.NewPlayer(decoder.SampleRate(), 2, 2, 8192) if err != nil { log.Fatal(err) } defer player.Close() if _, err := io.Copy(player, decoder); err != nil { log.Fatal(err) } }