Troubles with GOBOT

Hi every one, what is wrong with this code (I’m using Gobot) it has an input data to turn on the led when i = 0 and turn off when i = 1

I haven’t personally worked with gobot at all so I can’t say for certain if this is causing any issue, which by the way you haven’t actually mentioned what the issue is yet :stuck_out_tongue:, but my first suggestion would be to make sure you are checking every error possible. I would start by replacing f.Scan(&i) with:

if _, err := f.Scan(&i); err != nil {
    log.Fatalln(err)
}

Then I would make sure any function that returns an error is having it’s error checked. For example I can imagine that both the AddRobot and Start method’s have an error return value.

Also definitely check if there are errors returned from the red.On and red.Off methods if your issue is that the led’s aren’t turning on or off.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.