diff --git a/src/machine/machine_nrf52xxx.go b/src/machine/machine_nrf52xxx.go index 2d3545b7a9..927458f543 100644 --- a/src/machine/machine_nrf52xxx.go +++ b/src/machine/machine_nrf52xxx.go @@ -183,7 +183,12 @@ func (a *ADC) Get() uint16 { resolutionAdjustment = 4 // 12bit } - return rawValue.Get() << resolutionAdjustment + value := int16(rawValue.Get()) + if value < 0 { + value = 0 + } + + return uint16(value << resolutionAdjustment) } // SPI on the NRF.