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 "eeprom.h" 00003 //------------------------------------ 00004 // Hyperterminal configuration 00005 // 9600 bauds, 8-bit data, no parity 00006 //------------------------------------ 00007 00008 Serial pc(SERIAL_TX, SERIAL_RX); 00009 DigitalOut myled(LED1); 00010 00011 EEPROM mem(I2C_SDA, I2C_SCL,0); 00012 00013 int main() 00014 { 00015 00016 //Int เขียนและอ่าน 00017 /* 00018 int w_int = 1231101; 00019 int r_int; 00020 mem.write(0x0000,&w_int,4);//เขียน 00021 mem.read(0x0000,&r_int,4);//อ่าน 00022 pc.printf("%d\n",r_int); 00023 */ 00024 00025 //Char เขียนและอ่าน 00026 /* 00027 char w_str[20]="Liews Wuttipat"; 00028 char r_str[20]; 00029 mem.write(0x0000, w_str,14);//เขียน 00030 mem.read(0x0000, r_str,14);//อ่าน 00031 pc.printf("%s\n", r_str); 00032 */ 00033 00034 //Float เขียนและอ่าน 00035 /* 00036 float w_flt = 123.923456; 00037 float r_flt; 00038 mem.write(0, &w_flt,4);//เขียน 00039 mem.read(0,&r_flt,4);//อ่าน 00040 pc.printf("%f\n",r_flt); 00041 */ 00042 00043 00044 }
Generated on Fri Jul 15 2022 01:55:59 by
1.7.2