The function `setTickRate(hz)` can be used to configure how often rusEFI calls the `onTick` function. If your script does a lot of work in the `onTick()` function it may run slower than the desired rate. Since the Lua virtual machine runs at low priority compared to other functions of the ECU, it is impossible to swamp the ECU with too much Lua work, so set the tick rate to whatever is necessary.
-`index`: Index of the sensor to read. [A list of sensor indices can be found here.](https://github.com/rusefi/rusefi/blob/master/firmware/controllers/sensors/sensor_type.h)
- Returns
- A reading from the sensor, or `nil` if the sensor has a problem or isn't configured.
### `getSensorRaw(index)`
Reads the raw value from the specified sensor. For most sensors, this means the analog voltage on the relevant input pin.
- Parameters
-`index`: Index of the sensor to read. [A list of sensor indices can be found here.](https://github.com/rusefi/rusefi/blob/master/firmware/controllers/sensors/sensor_type.h)
- Returns
- The raw value that yielded the sensor reading, or 0 if the sensor doesn't support raw readings, isn't configured, or has failed.
Checks whether a particular sensor is configured (whether it is currently valid or not).
- Parameters
-`index`: Index of the sensor to check. [A list of sensor indices can be found here.](https://github.com/rusefi/rusefi/blob/master/firmware/controllers/sensors/sensor_type.h)
- Returns
- A boolean value, `true` if the sensor is configured, and `false` if not.
Initializes PWM on the specified index, starting at the specified frequency and duty cycle. The index selects which config field pin to use, see "Lua PWM Outputs" page in TunerStudio.
- Parameters
-`index`: The index of the PWM channel to start. Valid values are 0 through 7, one for each of the 8 channels.
-`frequency`: Initial frequency of the output, in hertz (cycles per second). Valid values are between 1 and 1000hz.
-`duty`: Initial duty cycle of the output. `0.0` = fully off, and `1.0` = fully on. `0.25` = on 25% of the time, off 75% of the time.
- Returns
- none
### `setPwmDuty(index, duty)`
Set the duty cycle of the specified PWM channel.
- Parameters
-`index`: The index of the PWM channel to set.
-`duty`: Desired duty cycle of the output. `0.0` = fully off, and `1.0` = fully on. `0.25` = on 25% of the time, off 75% of the time.
- Returns
- none
### `setPwmFreq(index, frequency)`
- Parameters
-`index`: The index of the PWM channel to set.
-`frequency`: Initial frequency of the output, in hertz (cycles per second). Valid values are between 1 and 1000hz.