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 I2C_HelloWorld_Mbed by
Revision 7:04a1f5398882, committed 2015-12-16
- Comitter:
- marcus255
- Date:
- Wed Dec 16 19:42:52 2015 +0000
- Parent:
- 6:35640814d53b
- Commit message:
- Reading/Writting EEPROM works fine, Reading/Writting works fine when temperature sensor connected to the i2c bus. Device addresses must be hardcoded for now.
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
| main.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Tue Dec 15 22:44:19 2015 +0000
+++ b/main.cpp Wed Dec 16 19:42:52 2015 +0000
@@ -12,7 +12,7 @@
if (conv2.getc() == DATA_TO_WRITE_CHAR){
char received = conv2.getc();
//conv2.putc(received);
- if (received == SLAVE_ADDR){ // writing to slave
+ if (received == RTC_ADDR){ // writing to slave
if (!transmission) {
i2c.start();
transmission = 1;
@@ -32,7 +32,7 @@
}
}
}
- else if (received == (SLAVE_ADDR | 0x01)){ // reading from slave
+ else if (received == (RTC_ADDR | 0x01)){ // reading from slave
char rec;
if (!transmission) {
i2c.start();
--- a/main.h Tue Dec 15 22:44:19 2015 +0000 +++ b/main.h Wed Dec 16 19:42:52 2015 +0000 @@ -3,6 +3,7 @@ #include "mbed.h" #define SLAVE_ADDR 0xA0 +#define RTC_ADDR 0xD0 #define UART_CONFIRMATION_CHAR 0x33 #define DATA_TO_WRITE_CHAR 0xCC #define DATA_TO_READ_CHAR 0x99
