0

For turning on led lights I want to access the GPIO of the orange-pi zero via gobot I am using gobot since my server from which i want to do this is written in Go. However on the platforms section of gobot it does not mention the orange-pi platform. I already got the gpio working via this library but it is written in Python.

I found an issue discussing the mapping of the device gpio but since I am new to the physical device scene i do not know how i would implement this into gobot

I have this version of the orange pi with the following pin configuration.

The sample code i found for enabling gpio on a raspberry pi is as follows:

    r := raspi.NewAdaptor()
    led := gpio.NewLedDriver(r, "7")

    work := func() {
        gobot.Every(1*time.Second, func() {
            led.Toggle()
        })
    }

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

    robot.Start()

I think the number on this line is relevant for my question led := gpio.NewLedDriver(r, "7")

My final question then is:

How do i use the gpio via gobot on an orange pi zero plus?

dvanderleij
  • 31
  • 1
  • 6
  • This is not an answer. But would you consider having two programs, the python program running as a daemon with an HTTP server for example to take commands from the Go program? I think that you won't find much support for orange-pi especially in Go. – Seaskyways Apr 03 '19 at 10:37
  • @Seaskyways, thanks for the suggestion I have thought of that possibility, I have also thought of the possibility of using CGO and a c library as that way i won't have to start another executable. It would be nice however to have one executable that handles everything. – dvanderleij Apr 03 '19 at 15:26
  • CGo is a great choice too ! You can , as an option, build your program with go, compile it as a C library, and use it in python. – Seaskyways Apr 03 '19 at 15:30

0 Answers0