Skip to content

Commit

Permalink
Scale analog values to 1024
Browse files Browse the repository at this point in the history
  • Loading branch information
zankich committed Jul 9, 2015
1 parent 5b94e59 commit d560583
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion platforms/intel-iot/edison/edison_adaptor.go
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,10 @@ func (e *EdisonAdaptor) AnalogRead(pin string) (val int, err error) {
if err != nil {
return
}
return strconv.Atoi(string(buf[0 : len(buf)-1]))

val, err = strconv.Atoi(string(buf[0 : len(buf)-1]))

return val / 4, err
}

// I2cStart initializes i2c device for addresss
Expand Down
2 changes: 1 addition & 1 deletion platforms/intel-iot/edison/edison_adaptor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,5 +179,5 @@ func TestEdisonAdaptorAnalog(t *testing.T) {

fs.Files["/sys/bus/iio/devices/iio:device1/in_voltage0_raw"].Contents = "1000\n"
i, _ := a.AnalogRead("0")
gobot.Assert(t, i, 1000)
gobot.Assert(t, i, 250)
}

0 comments on commit d560583

Please sign in to comment.