Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
main.cpp
00001 #include "mbed.h" 00002 #include "MAX17048.h" 00003 00004 MAX17048 gauge(p28, p27); 00005 00006 int main() 00007 { 00008 //Try to open the MAX17048 00009 if (gauge.open()) { 00010 printf("Device detected!\n"); 00011 00012 //Load the default compensation value 00013 gauge.compensation(MAX17048::RCOMP0); 00014 00015 while (1) { 00016 //Print the current state of charge 00017 printf("SOC = %f%%\n", (float)gauge); 00018 00019 //Sleep for 0.5 seconds 00020 wait(0.5); 00021 } 00022 } else { 00023 error("Device not detected!\n"); 00024 } 00025 }
Generated on Tue Jul 12 2022 21:11:10 by
