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.
Fork of Nucleo_eeprom by
main.cpp@2:27acee628363, 2015-08-25 (annotated)
- Committer:
- soulx
- Date:
- Tue Aug 25 12:06:56 2015 +0000
- Revision:
- 2:27acee628363
- Parent:
- 1:8b005d040c91
- Child:
- 3:8d9d440c1a2c
add int16
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| soulx | 0:8b5e53600ba0 | 1 | #include "mbed.h" |
| soulx | 0:8b5e53600ba0 | 2 | #include "eeprom.h" |
| soulx | 0:8b5e53600ba0 | 3 | |
| soulx | 0:8b5e53600ba0 | 4 | |
| soulx | 0:8b5e53600ba0 | 5 | EEPROM memory(I2C_SDA,I2C_SCL,EEPROM_Address); |
| soulx | 0:8b5e53600ba0 | 6 | |
| soulx | 0:8b5e53600ba0 | 7 | int main() |
| soulx | 0:8b5e53600ba0 | 8 | { |
| soulx | 0:8b5e53600ba0 | 9 | char value='A'; |
| soulx | 0:8b5e53600ba0 | 10 | char data[2]; |
| soulx | 0:8b5e53600ba0 | 11 | memory.write(1,value); |
| soulx | 0:8b5e53600ba0 | 12 | memory.write(2,'a'); |
| soulx | 0:8b5e53600ba0 | 13 | memory.read(1,data,2); |
| soulx | 0:8b5e53600ba0 | 14 | printf("read[1] = %c\n",data[0]); |
| soulx | 0:8b5e53600ba0 | 15 | printf("read[2] = %c\n",data[1]); |
| soulx | 0:8b5e53600ba0 | 16 | |
| soulx | 1:8b005d040c91 | 17 | float x=0.0f; |
| soulx | 1:8b005d040c91 | 18 | memory.write(10,1.23f); |
| soulx | 1:8b005d040c91 | 19 | memory.read(10,x); |
| soulx | 1:8b005d040c91 | 20 | printf("float = %f\n",x); |
| soulx | 1:8b005d040c91 | 21 | |
| soulx | 2:27acee628363 | 22 | int16_t y=16200,z; |
| soulx | 2:27acee628363 | 23 | memory.write(1,y); |
| soulx | 2:27acee628363 | 24 | memory.read(1,z); |
| soulx | 2:27acee628363 | 25 | printf("int16 =%d\n",z); |
| soulx | 2:27acee628363 | 26 | |
| soulx | 0:8b5e53600ba0 | 27 | } |
