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.
Dependencies: mbed
main.cpp
- Committer:
- rodrigogenes
- Date:
- 2017-02-27
- Revision:
- 0:bdd449e55907
- Child:
- 1:f77859e74071
File content as of revision 0:bdd449e55907:
// Simple I2C responder #include <mbed.h> I2CSlave slave(D14, D15); int main() { DigitalOut myLED (LED2); slave.address(0x14); char buf[10]; while (1) { int i = slave.receive(); switch (i) { // case I2CSlave::ReadAddressed: // slave.write(5); // Includes null char // myLED=0; // break; //case I2CSlave::WriteGeneral: //to implement case I2CSlave::WriteAddressed: slave.read(buf, 10); if (buf ==1){ myLED=1; } break; } for(int i = 0; i < 10; i++) buf[i] = 0; // Clear buffer } }