![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
example program how to us the MCP4728 class and DevInterface classes
Dependencies: mbed DevInterfaces MCP4728 MCP4728setaddr I2Cinterfaces
Diff: main.cpp
- Revision:
- 6:d1e569f370ac
- Parent:
- 5:18d7ce800a18
- Parent:
- 3:e12e21dcd16a
diff -r 18d7ce800a18 -r d1e569f370ac main.cpp --- a/main.cpp Fri Jan 13 14:00:15 2017 +0000 +++ b/main.cpp Fri Jan 13 14:02:39 2017 +0000 @@ -71,7 +71,9 @@ if ( i2cresult ) printf("failed to set address to %d error : %d , sclcnt= %d \n",newaddr, i2cresult,mpc4728.getsclcnt()); else { printf("set new address \n"); + i2cresult =mpc4728.readaddress(oldaddr, eeaddr, regaddr); + if ( i2cresult ) printf("failed to read (new) address error : %d \n", i2cresult); else printf( "new address = %d ,eeaddr %d , regaddr %d sclcnt= %d \n\r", (int) oldaddr,(int) eeaddr, (int)regaddr, mpc4728.getsclcnt()); printf( " new address = %d \n", (int) oldaddr); }