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 slave_i2c3 by
Revision 0:24e80ff2c7b1, committed 2014-12-06
- Comitter:
- viswachaitanya
- Date:
- Sat Dec 06 06:24:28 2014 +0000
- Child:
- 1:4c71a7675750
- Commit message:
- m_r_s
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
| mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Sat Dec 06 06:24:28 2014 +0000
@@ -0,0 +1,29 @@
+#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_send = new char;
+ *data_send = 'k';
+ slave.address(0x20);
+ int slave_status=1;
+ while(loopvariable1){
+ if(slave.receive()==1){
+ slave_status=slave.write(data_send,1);
+ if(!slave_status){
+ printf("1 wrote %c to master\n\r",*data_send);
+ loopvariable1 = false;
+ }
+ }
+ }
+ printf("2 done");
+ }
+ }
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Sat Dec 06 06:24:28 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/4fc01daae5a5 \ No newline at end of file
