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 "MAX1704X.h" 00003 00004 //Create an MAX1704X object at the default address (ADDRESS_0) 00005 MAX1704X battery_level(D14, D15); //sda, scl 00006 00007 int main() 00008 { 00009 //Try to open the MAX1704X 00010 if (battery_level.open()) { 00011 printf("Device detected!\n"); 00012 00013 while (1) { 00014 //Print the current battery level 00015 printf("battery = %d\n", battery_level.read_percent()); 00016 00017 //Sleep for 1 seconds 00018 wait(1); 00019 } 00020 } else { 00021 error("Device not detected!\n"); 00022 } 00023 }
Generated on Tue Jul 26 2022 08:37:44 by
1.7.2