Your script should look more like this:
function GetRequiredPids()
{
Obdii.AddRequiredPid("GM.ENGINE.AFR");
}
var AirFuelRatio = Obdii.GetPidValueEnglish("GM.ENGINE.AFR");
var CalculatedValue;
if (AirFuelRatio == null)
{
CalculatedValue = 0;
}
else
{
CalculatedValue = AirFuelRatio / 14.68;
}
Obdii.PidValue.English = CalculatedValue;
Obdii.PidValue.Metric = CalculatedValue;When you reference a PID, like with the GetPidValueEnglish function, it should have quotes around it because its a string. You also can't put just a PID name in and treat it like a variable (you did
if(GM.ENGINE.AFR == null)), you need to use GetPidValueEnglish to save that value to a variable (which I named
AirFuelRatio). It also looks like you were trying to set the units to LAMBDA, which should be done using the input boxes at the top of the script editing window. If you have any other trouble we're always here to help.
Keep trying though, and let us know how it all works out.
