If you wanted to do it like that the code would look more like this:
int analogPin = A0;
int Ohms = 0;
int val = (A0);
Serial.begin(2400); // setup serial
int val = analogRead(0);
val = map(val, 0, 1023, 0, 315);
Serial.println(val); // debug value
Serial.print ("Ohms = ");
So we say 0 to 315 Ohms but that assumes linearity which the fuel sensor is not. What that tells me is using those numbers is that 157.5 Ohms is 1/2 tank of gas and we know it is not. Half tank is about 116 to 126 with a nominal of about 121 Ohms.
When the numbers are not linear we call them logarithmic. Not quite a straight line equation.
The Arduino uses a 10 bit ADC or 2^10 = 1024 meaning with the Arduino 5 Volt Ref (normally not very accurate) an analog input of 0 to 5 volts = 0 to 1023 bits which is 1025 quantization levels. So what the code is doing is looking at A0 assigning a range of 0 to 1023 and then mapping it to 0 to 315. That's all the code is doing. I apply 1.5 volts and I see 117 Ohms with the code I just posted. I apply 5 volts and get 315.
One thing isn't clear for me, it's wiring. I need to connect signal wire to one of arduino's analog pins and that's all? gnd and signal wires are connected to car's chassis.
Probably i need to make voltage divider, connect +12v trough divider to arduino, then connect signal ground to arduino's ground and signal wire to analog pin?