Basic C++ IOT Weather Station
I'll assume the indentation is an artifact of pasting the code here.

The big problem here is that long series of if statements.  A simple improvement is to make use of the else clause, along with knowledge of what values you've tested for already, it can be simplified to

if (sensorValue &lt;= 10)
    UVLevel = 0;
else if (sensorValue &lt;= 46)
    UVLevel = 1;
// etc.


But we can do better.  Since the range of values you're checking with is contiguous, and the result (UVLevel) is linear, we can set up an array to hold the data, then just use a loop to find the right place.

static values[] = { 10, 46, 65, /* ... */, 240 };
UVLevel = std::size(values);    // 12
for (int i = 0; i &lt; std::size(values); ++i)
    if (values[i] &lt;= sensorValue) {
        UVLevel = i;
        break;
    }
}


We initially set UVLevel the the maximum value so that if the sensor value is greater than 240 we get the correct result without having to check after the loop.

For a larger range of possible values, the for loop used here can be replaced with a more complicated binary search.