Guest User

Untitled

a guest
Jul 18th, 2018
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.73 KB | None | 0 0
  1. while ( 0 != sendstatus && 10 >= fail ) //try until it goes through or you fail to much
  2.     {
  3.       Wire.beginTransmission(Target); // transmit to target
  4.       for ( int data = 0; data < commandlength; data++)   //while still have data loop
  5.       {
  6.         Wire.write(command[data]);    //send it
  7.       }
  8.       sendstatus = Wire.endTransmission();    // stop transmitting
  9.       if ( 0 != sendstatus )
  10.       {
  11.         Serial.print("GFail:");
  12.         Serial.println(fail);
  13.         fail++;                             //haha fail
  14.         delay(random(0,1000));              //wait for random
  15.       }
  16.     }
  17.     if ( 0 == sendstatus ) 
  18.     {
  19.       Serial.println("GIACK");              //YAY you win
  20.     }
  21.     else
  22.     {
  23.       Serial.println("GINACK");             //haha fail
  24.     }
Add Comment
Please, Sign In to add comment