Hello !
I'm trying to make a controller for real gauges , using outsim and processing ( java-like environement )
I'm able to connect and recieve UDP packets from the game, but i've got some troubles to make them understandable.
I've already done the 7 segment driver, and got it work with the corect outgauge value since it's a byte.
I can correctly read the Speed , but most of the time my code returns me " NaN " which means " not a number " , especially from 70 to 130 kph.
Here's the debug code :
What am i doing wrong ?
Thanks !
edit : I've already looked the insim.txt, and others threads on the forum , nothing helped me
I'm trying to make a controller for real gauges , using outsim and processing ( java-like environement )
I'm able to connect and recieve UDP packets from the game, but i've got some troubles to make them understandable.
I've already done the 7 segment driver, and got it work with the corect outgauge value since it's a byte.
I can correctly read the Speed , but most of the time my code returns me " NaN " which means " not a number " , especially from 70 to 130 kph.
Here's the debug code :
void receive(byte[] data, String HOST_IP, int PORT_RX)
{
byte[] rawSpeed = new byte[4];
rawSpeed[0] = data[12];
rawSpeed[1] = data[13];
rawSpeed[2] = data[14];
rawSpeed[3] = data[15];
int bits = 0;
for(int i = 3; i >= 0; i--)
{
bits |= rawSpeed[i] << 8*i;
}
float speed = Float.intBitsToFloat(bits);
println(speed*3.6);
}
What am i doing wrong ?
Thanks !
edit : I've already looked the insim.txt, and others threads on the forum , nothing helped me