 
	
You are here: Forum Home → ANT Developers Forums → ANT+ FIT Forum Has Moved → Thread
ObdiiDataMesg OB = new ObdiiDataMesg(); 
//
//
 Float singlefloatdata=(float) float_vector[ii];
 int num = (Integer.parseInt("0C", 16)); // This for PID code that is in Hex
 OB.setPid((byte) num);
    
   Byte to_row_data_byte =singlefloatdata.byteValue(); //probably error is here...?
  OB.setRawData(0, to_row_data_byte);
  encode.write(OB); 
ObdiiDataMesg ob = new ObdiiDataMesg(); 
Float singleFloatData = (float)float_vector[ii];
int num = (Integer.parseInt("0C", 16)); // This for PID code that is in Hex
ob.setPid((byte) num);
short rowData = singleFloatData.shortValue();
// Encode bytes in Little Endian format
ob.setRawData(0, rowData);
ob.setRawData(1, rowData >> 8);
encode.write(ob); 
ObdiiDataMesg OB = new ObdiiDataMesg(); 
  OB.setSystemTime(0, (long) i);  // This line was omitted... but now i don't know what think...
     OB.setSystemTime(1, (long) i);
     int num = (Integer.parseInt("0C", 16)); // This for PID Field
     OB.setPid((byte) num);
    Short rowData = doublevectordata.shortValue(); 
//FIRST TRIAL
    ByteBuffer buffer = ByteBuffer.allocate(1000); 
     buffer.order(ByteOrder.LITTLE_ENDIAN);       
     buffer.putShort(rowData);
     OB.setRawData(0,buffer.get(8));
     OB.setRawData(1,buffer.get(0));
// SECOND TRIAL
    OB.setRawData(0,(byte)(rowData>>8));
     OB.setRawData(1,(byte) (rowData.byteValue() & 0xff));
// THIRD TRIAL
   OB.setRawData(0,(byte) (rowData.byteValue() & 0xFF));
   OB.setRawData(1, (byte)(rowData>>8));