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 "_24LCXXX.h" 00003 00004 I2C i2c(dp5,dp27); // sda, scl 00005 Serial pc(dp16, dp15); // tx, rx 00006 _24LCXXX eeprom(&i2c, 0x50); 00007 00008 DigitalOut myled(LED1); 00009 00010 int main() { 00011 pc.baud(9600); 00012 char data1; 00013 int data2; 00014 00015 pc.printf("memoroy byte data write!\n"); 00016 eeprom.byte_write(0, 1); 00017 eeprom.byte_write(1, 2); 00018 eeprom.byte_write(2, 3); 00019 eeprom.byte_write(3, 4); 00020 pc.printf("end\n"); 00021 00022 eeprom.nbyte_read( 0, &data1, 1 ); 00023 pc.printf("0:%02x ",data1); 00024 eeprom.nbyte_read( 1, &data1, 1 ); 00025 pc.printf("1:%02x ",data1); 00026 eeprom.nbyte_read( 2, &data1, 1 ); 00027 pc.printf("2:%02x ",data1); 00028 eeprom.nbyte_read( 3, &data1, 1 ); 00029 pc.printf("3:%02x ",data1); 00030 pc.printf("\nend\n"); 00031 00032 pc.printf("memoroy int data write!\n"); 00033 data2 = 100; 00034 eeprom.nbyte_write( 10, &data2, sizeof(int)); 00035 pc.printf("\nend\n"); 00036 00037 eeprom.nbyte_read( 10, &data2, sizeof(int) ); 00038 pc.printf("int:%d ",data2); 00039 pc.printf("\nend\n"); 00040 00041 while(1) { 00042 myled = 1; 00043 wait(0.2); 00044 myled = 0; 00045 wait(0.2); 00046 } 00047 }
Generated on Sun Jul 17 2022 01:07:19 by
1.7.2