flt2u32 — unsigned fractional number conversion into appropriate form for comparison operators.


u32 flt2u32(u32 value);

Returns unsigned fractional value converted to the form applicable for comparison operators (for example: converts fractional 20.5 into integer 5248). Later the obtained figure is possible to be used in comparison with data received from sensors.

List of parameters:


Unsigned fractional (fractional part is separated by a dot) Only literal.

Return values:

Returns unsigned integer. Type of return value u32.


<import-script id="512" MS="512:32" name="Test for flt2u32 function">

	u32 ms = flt2u32(20.5);
	u8 strForMess[70];

	if([MS] > ms) 
		sprintf(strForMess, "%c%d > %d", 1, [MS], ms);
		if([MS] == ms) 
			sprintf(strForMess, "%c%d = %d", 1, [MS], ms);
			sprintf(strForMess, "%c%d less %d", 1, [MS], ms);

	setStatus(2023:32, &strForMess);


The result of performing the example in the interface:

The message where the values of motion sensor are compared with the value 20.5 is displayed in the interface every two seconds.


Only literal (figure, not a variable) can be the parameter lvalue.