Seeker of Truth , / Mbed 2 deprecated freemaster_write2master_working

Dependencies:   mbed

Fork of freemaster_write2master_working by green rosh

Revision:
4:0b714f858ed2
Parent:
3:c810e140a6bf
--- a/main.cpp	Fri Dec 12 08:53:06 2014 +0000
+++ b/main.cpp	Fri Dec 12 12:15:54 2014 +0000
@@ -5,7 +5,7 @@
 Serial pc (USBTX,USBRX);
 DigitalOut interrupt(D9);
 InterruptIn data_ready(D10);
-
+bool looper;
 
 
 void FUNC_I2C_MASTER()
@@ -14,6 +14,9 @@
     //while(1){
             //interrupt = 0;
       //  if(pc.getc()=='z'){
+            /*while (looper){
+                wait(0.5);
+                break;}*/
             wait(0.5);
             interrupt = 1;
             printf("\nMaster executed\n");
@@ -53,7 +56,7 @@
             }
             if(!ack0)
             {
-                    printf("\n master has read %c from slave\n\r",*data);
+                    printf("\n master has read ");
                     loopvariable0=false;
             }
                 //master.stop();
@@ -61,12 +64,14 @@
             //printf("done\n\r");
             delete data;
             interrupt=0;
+            looper = false ;
             }
             
 
 int main()
 {   
     data_ready.rise(&FUNC_I2C_MASTER);
+    looper = true;
     printf("\nstarted master\n");
     bool write2slave;
      char *writedata = new char;
@@ -88,7 +93,7 @@
                 master_status_write = (bool) master.write(addr|0x00,writedata,1);
                 if(master_status_write==0)
                     {
-                    printf("master has written %c to slave\n\r",*writedata);
+                    printf("master has written");
                     write2slave=false;
                     }
             }