![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
jkjkjkjk
Fork of all_combined_week6 by
Diff: slave.cpp
- Revision:
- 6:82153349cc9b
- Parent:
- 4:79b97f9cab00
- Child:
- 7:5cf19bfdbacd
diff -r c7cd684d25a8 -r 82153349cc9b slave.cpp --- a/slave.cpp Sat Jul 12 07:27:15 2014 +0000 +++ b/slave.cpp Tue Jul 15 10:04:38 2014 +0000 @@ -13,7 +13,7 @@ acknowledge = slave.write(send); //sending the byte to master if(acknowledge==1) { - screen.printf(" acknowledge %d sent %x \n",acknowledge,send); + screen.printf(" acknowledge %d sent %u \n",acknowledge,send); loopvariable4=0; } } @@ -24,7 +24,7 @@ void FUNC_I2C_SLAVE_MAIN(int iterations) { - wait(0.5); + screen.printf("\nSlave entered\n"); slave.address(slave_address); //assigning slave address char Switch_Variable; @@ -47,8 +47,10 @@ //to interpret and write data to master switch(Switch_Variable) { - - case '1': while(loopvariable3) + + + case 1: printf("\nEntered switch\n"); + while(loopvariable3) { if(slave.receive()==ReadAddressed) //check if slave is addressed to read { @@ -71,6 +73,7 @@ } loopvariable2++; }//while(loopvariable2<30) + printf("\nExited i2c while loop\n"); slave.stop(); loopvariable3=0; }//if(read addressed) @@ -78,12 +81,12 @@ }//while(loopvariable3) break; - case '2' : screen.printf(" telecommand 2\n"); + case 2 : screen.printf(" telecommand 2\n"); break; }//switch case ends } } - screen.printf("done"); + screen.printf("\nexited slave function\n"); } \ No newline at end of file