FUEL GAUGE PART#4712

Breakout boards, sensors, other Adafruit kits, etc.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
williamlynn
 
Posts: 74
Joined: Fri Dec 17, 2010 5:51 pm

FUEL GAUGE PART#4712

Post by williamlynn »

CAN YOU SUPPLY THE CODE USED TO GET THE lc709203F(ADAFRUIT PART#4712) FUEL GAUGE TO WORK WITH THE "FEATHER" AS IT IS SHOWN ON THE ADAFRUIT WEB PAGE.

User avatar
dastels
 
Posts: 15819
Joined: Tue Oct 20, 2015 3:22 pm

Re: FUEL GAUGE PART#4712

Post by dastels »


User avatar
williamlynn
 
Posts: 74
Joined: Fri Dec 17, 2010 5:51 pm

Re: FUEL GAUGE PART#4712

Post by williamlynn »

The code is the tutorial is has nothing to do with the FEATHER or the or the FEATHER LED WING. Would be nice if you could supply the code to get it working like it shows in the picture for the LED WING, picture attached.
Attachments
4712_picture.png
4712_picture.png (313.77 KiB) Viewed 148 times

User avatar
dastels
 
Posts: 15819
Joined: Tue Oct 20, 2015 3:22 pm

Re: FUEL GAUGE PART#4712

Post by dastels »

I didn't find any examples beyond what's in the guide or the github repos for the fuel gauge (which are linked from the guide). The Guide gives you the information on how to use the sensor. The guide for the OLED FeatherWing covers how to display on the OLED: https://learn.adafruit.com/adafruit-128 ... eatherwing. Both C++ and CircuitPython are covered in each. Between those two guides, you have everything you need to recreate the demo.

For example, I took a few minutes before breakfast and cobbled together this from the examples in those guides:

Code: Select all

#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SH110X.h>
#include "Adafruit_LC709203F.h"

Adafruit_SH1107 display = Adafruit_SH1107(64, 128, &Wire);
Adafruit_LC709203F lc;

void setup()
{
  Serial.begin(115200);
  while (!Serial);
  Serial.println("\nAdafruit LC709203F demo");

  if (!lc.begin()) {
    Serial.println(F("Couldnt find Adafruit LC709203F?\nMake sure a battery is plugged in!"));
    while (1) delay(10);
  }
  lc.setThermistorB(3950);
  lc.setPackSize(LC709203F_APA_500MAH);
  lc.setAlarmVoltage(3.8);
  display.begin(0x3C, true);
  display.display();
  delay(1000);
  display.clearDisplay();
  display.display();

  display.setRotation(1);
  display.setTextSize(1);
  display.setTextColor(SH110X_WHITE);
}


void loop()
{
  
//  Serial.print("Batt Voltage: "); Serial.println(lc.cellVoltage(), 3);
//  Serial.print("Batt Percent: "); Serial.println(lc.cellPercent(), 1);
  
  display.clearDisplay();
  display.setCursor(0, 0);
  display.println("LC709203");
  display.print("Voltage: ");
  display.print(lc.cellVoltage(), 2);
  display.println("V");
  display.print("Percent: ");
  display.print(lc.cellPercent(), 0);
  display.println("%");
  display.display();
  lc.getCellTemperature();
  delay(2000);
}
The font in the demo leads me to think it's either using the GFX library or done in CircuitPython using displayio.

Dave

User avatar
williamlynn
 
Posts: 74
Joined: Fri Dec 17, 2010 5:51 pm

Re: FUEL GAUGE PART#4712

Post by williamlynn »

Thanks for info

Locked
Please be positive and constructive with your questions and comments.

Return to “Other Products from Adafruit”