mrmorphic / hwio

Go library for hardware I/O control, in the programming style of Arduino
BSD 3-Clause "New" or "Revised" License
328 stars 40 forks source link

could not find a pin #52

Open mtavano opened 7 years ago

mtavano commented 7 years ago

I worked with hwio the past February, and everything worked OK, but now when I've tried to work with the same codebase, this error message came up: Could not find a pin called gpio2

my code looks like this

package main

import (
    "log"

    "github.com/mrmorphic/hwio"
)

func main() {
    gpio, err := hwio.GetPinWithMode("gpio2", hwio.OUTPUT)
    check(err)
    defer hwio.CloseAll()

    err = hwio.DigitalWrite(gpio, hwio.HIGH)
    check(err)
    err = hwio.DigitalWrite(gpio, hwio.LOW)
    check(err)
}

func check(err error) {
    if err != nil {
        log.Fatal(err)
    }
}

Ofcourse, I've tried with many differents pins.

mrmorphic commented 7 years ago

That's odd. There have been no changes in the library that would effect that. What device are you using? Also, have there been any updates to the device?

mrmorphic commented 7 years ago

I've created issue https://github.com/mrmorphic/hwio/issues/53 in order to add board revisions that are currently missing from driver selection. If you're running the same code on a model 3 board, this is probably what's going on.