Skip to content
This repository was archived by the owner on Sep 30, 2019. It is now read-only.
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion Adafruit_ADS1x15/Adafruit_ADS1x15.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,11 @@ def readADCDifferential(self, chP=0, chN=1, pga=6144, sps=250):
result = self.i2c.readList(self.__ADS1015_REG_POINTER_CONVERT, 2)
if (self.ic == self.__IC_ADS1015):
# Shift right 4 bits for the 12-bit ADS1015 and convert to mV
return ( ((result[0] << 8) | (result[1] & 0xFF)) >> 4 )*pga/2048.0
val=( ((result[0] << 8) | (result[1] & 0xFF)) >> 4 );
if val > 2047.0:
return (val - 4096.0)*pga/2048.0
else: return val*pga/2048.0

else:
# Return a mV value for the ADS1115
# (Take signed values into account as well)
Expand Down