Advertisement
Guest User

Untitled

a guest
Mar 3rd, 2016
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.86 KB | None | 0 0
  1. for(int l=0; l<4;l++) {
  2.     final int iteration= l;
  3.  
  4.     i2cModule.writeData((byte) 0x34, (byte) 0x00, new byte[]{(byte) 0xA0, (byte) 0x13});
  5.     i2cModule.readData((byte)0x34, (byte)0xA0, (byte)4).onComplete(new CompletionHandler<byte[]>() {
  6.         @Override
  7.         public void success(byte[] result) {
  8.             // Handle V1 here
  9.  
  10.             i2cModule.writeData((byte) 0x34, (byte) 0x00, new byte[]{(byte) 0xA1, (byte) 0x13});
  11.             i2cModule.readData((byte)0x34, (byte)0xA1, (byte)4).onComplete(new CompletionHandler<byte[]>() {
  12.                 @Override
  13.                 public void success(byte[] result) {
  14.                     // Handle V2 here
  15.                     if (iteration == 3) {
  16.                         // compute averages
  17.                         // update chart
  18.                     }
  19.                 }
  20.             });
  21.         }
  22.     });
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement