Anyone figure out how to get the battery level reading from Sparkfun's LiPower shield using a Netduino Plus 2?
I've added the shield and connected the shield's A04 to N+2's SDA and A05 to SCL. Also tried no additional connections (just the A04/05 connected through the stackable headers).
Specifically, I'm just trying to get the percentage battery level from the LiPower's MAX17043's SOC (state of charge) register. I'm using 0x36 to identify the device and 0x04 to identify the SOC register, as per Sparkfun's sample Arduino code.
Here's my code. It always returns exec = 0, so even the write transaction fails.
I2CDevice.Configuration con = new I2CDevice.Configuration(0x36, 50);I2CDevice MyI2C = new I2CDevice(con);I2CDevice.I2CTransaction[] xActions = new I2CDevice.I2CTransaction[2];byte[] RegisterNum = new byte[1] { 0x04 };xActions[0] = I2CDevice.CreateWriteTransaction(RegisterNum);byte[] RegisterValue = new byte[2] { 0, 0 };xActions[1] = I2CDevice.CreateReadTransaction(RegisterValue);int exec = 0;exec = MyI2C.Execute(xActions, 1000);if (exec == 0){ Debug.Print("Failed to perform I2C transaction"); }else{ Debug.Print("Register value: " + RegisterValue[0].ToString()); }
Anyone able to get battery level readings from LiPower? How?