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 00003 I2C link(I2C_SDA, I2C_SCL); 00004 const int addr = 0x7C; 00005 00006 void Init(void){ 00007 char cmd[2]; 00008 cmd[0] = 0x80; 00009 cmd[1] = 0x3F; 00010 link.write(addr,cmd,2); 00011 wait_us(100); 00012 00013 cmd[1] = 0x0F; 00014 link.write(addr,cmd,2); 00015 wait_us(100); 00016 00017 cmd[1] = 0x01; 00018 link.write(addr,cmd,2); 00019 wait_ms(2); 00020 00021 cmd[1] = 0x06; 00022 link.write(addr,cmd,2); 00023 00024 cmd[1] = 0xC0; 00025 link.write(addr,cmd,2); 00026 wait_us(100); 00027 } 00028 00029 00030 int main(void){ 00031 char data[3]; 00032 00033 data[0] = 0x40; 00034 data[1] = '0'; 00035 data[2] = '0'; 00036 00037 while(1){ 00038 Init(); 00039 link.write(addr,data,3); 00040 if (data[2] < '9'){ 00041 data[2]++; 00042 }else{ 00043 data[2] = '0'; 00044 if(data[1] < '5'){ 00045 data[1]++; 00046 }else{ 00047 data[1] = '0'; 00048 } 00049 } 00050 wait(0.5); 00051 } 00052 }
Generated on Sat Jul 23 2022 22:50:35 by
1.7.2