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 freemaster_write2master_working by
main.cpp
- Committer:
- viswachaitanya
- Date:
- 2014-12-06
- Revision:
- 0:9ea68477caaf
- Child:
- 1:8e4b5e1f8039
File content as of revision 0:9ea68477caaf:
#include "mbed.h" const int addr = 0x20; //slave address I2C master (D14,D15); //configure pins p27,p28 as I2C master Serial pc (USBTX,USBRX); void main() { printf("press backspace for master to start \n\r"); while(1){ if(pc.getc()==8){ bool ack0 =true; char *data = new char; *data = 'b'; bool loopvariable0 = true; while(loopvariable0){ printf("2 master clk freq setup and addressing slave\n\r"); master.frequency(100000); //set clock frequency master.start(); //initiating the data transfer ack0 = (bool) master.read(addr,data,1); if(!ack0){ printf("3 master has read %c from slave\n\r",*data); loopvariable0=false; } } printf("done\n\r"); } } }