2020NSE_SSLB4
/
eeprom_test
STM32F303K8T6で24LC1025を使うプログラム
main.cpp
- Committer:
- sashida_h
- Date:
- 2019-11-20
- Revision:
- 0:a7302d1293f6
- Child:
- 2:a1e177ea1f32
File content as of revision 0:a7302d1293f6:
#include "mbed.h" #include "24LC1025.h" Serial pc(PA_2, PA_3); I2CEEprom i2c; int main() { pc.baud(115200); pc.printf("Hello OSHIMA\r\n"); unsigned char x; char a[1000]; // 書き込む場合 for(int i=0; i<8; i++, x++) { a[0] = 'T'; a[1] = 'A'; a[2] = 'K'; a[3] = 'E'; a[4] = 'Y'; a[5] = 'U'; a[6] = 'K'; a[7] = 'I'; i2c.write(i, a[i]); } // 読み込む場合 for(int i=0; i<8; i++) { x = i2c.read(i); pc.printf("%04x,%c ",i,x); } pc.printf("\n"); }