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.
main.cpp
- Committer:
- viswachaitanya
- Date:
- 2014-12-06
- Revision:
- 0:4add0b6d656a
File content as of revision 0:4add0b6d656a:
#include "mbed.h"
void write_to_master(char); //function to write data to master
I2CSlave slave(D14,D15); //configuring pins p27, p28 as I2Cslave
Serial pc (USBTX,USBRX);
void main(){
printf("press backspace for slave to start \n\r");
while(1){
if(pc.getc()==8){
bool loopvariable1= true;
char *data_rec = new char;
slave.address(0x20);
int slave_status=1;
while(loopvariable1){
slave_status=slave.read(data_rec,1);
if(!slave_status){
printf("read %c from master\n\r",*data_rec);
loopvariable1 = false;
}
}
}
}
}