Li Power Shield and using LCD screen 16x2

I grabbed the example code from the sparkfun website under the Documents section:

http://dlnmh9ip6v2uc.cloudfront.net/datasheets/Dev/Arduino/Shields/LiPower_Shield_Example.ino

Then I modified it to work with my LCD screen and not the serial monitor, since the code provided is inherently dangerous. Please see my code attached.

clang | last year 1

What may happen if I plug the Arduino to USB to upload some sketch with connected LiPower Shield with battery attached?

tim7 | last year * 1

That would not be a healthy thing to do. The Uno’s power circuitry connects the 5V pin to USB power whenever Vin is less than 6.6V. The LiPower shield doesn’t supply Vin, so you’d end up with the output of the 5V step-up regulator on the shield shorted to the USB power on the Uno.
Member #338104 | about 6 months ago 1

Doesn’t that mean the example code is inherently dangerous? (Sorry to zombie your reply.)

I run into problems with the i2cWrite16(unsigned int data, unsigned char address) function. There is something screwy in this function that causes my USB connection to port 7 (Arduino Port) to bounce, meaning I can no longer communicate with my arduino anymore until I unplug and reboot computer. It probably has to do with

// R/W =~ 0x6D/0x6C
#define MAX17043_ADDRESS 0x36

All I can say is my R/W pin on LCD screen is wired to ground. What does this code mean? I tried all values, so how do I know what will work for me? Please help! :frowning:

BatteryShield_lcd.ino (8.06 KB)

bump! 8) i would like to hear some responses. thank you.

Don't understand your problem fully but I can point out that you mixed up R/W address of I2C device with R/W pin of LCD. They are not related. So is the LCD working all by itself with hello world code? Is it working in your code?

Thanks for pointing that out. Yes, the wiring is correct to the LCD screen, as I can load my Burger Monday's Sketch to display correctly. But then when i load the Battery Report sketch, the code bounces my usb connection to the arduino. After some debugging and revealing code 1 line at a time I've narrowed it down to being MAX17043_ADDRESS when used in function

/************************************************************************
5. i2cWrite16(unsigned int data, unsigned char address) writes 16 bits
   of data beginning at an 8-bit address, and continuing to the next.
************************************************************************/
void i2cWrite16(unsigned int data, unsigned char address)
{
  Wire.beginTransmission(MAX17043_ADDRESS);   //PROBLEM SOMEWHERE HERE!!!!!!!
  //Wire.write(address);
  //Wire.write((byte)((data >> 8) & 0x00FF)); 
  //Wire.write((byte)(data & 0x00FF));
  Wire.endTransmission();
}

Burger Monday's Example http://www.youtube.com/watch?v=_Jr5lvjPqxc