GetSensor()
Description
This function is used inline with ReadRecord, after ReadRecord function was called.
This function is used to get sensor data from an array
Syntax
GetSensor(sensor_array[], sensor_Id, tmp);
Parameters
Variable | Input |
|---|---|
| Array which was used in ReadRecord function to store sensor information. |
|
|
| Is a variable into which sensor data will be written into. (in case requested sensor is missing from array - tmp value will be 0) |
Returns
Return value | Return explanation |
SCRIPT_OPERATION_SUCCESS | Success |
Function call example
Example of getting sensor value
new sensor_buffer[1000];
new tmp = 0;
main()
{
for(;;)
{
if(ReadRecord(PARSE_RECORD, sensor_buffer, 0)) // check if ReadRecord is not empty and store record into array named `sensor_buffer`
{
GetSensor(sensor_buffer, SENSOR_COURSE, tmp); // get SENSOR_COURSE into variable named `tmp` from array named `sensor_buffer`
}
Delay(1000);
}
}