Ive been working a bit on an extension of my Raspi/OpenWeatherMap demo and thought of a human readable wind direction.
So I took the Winddirection in degrees as Double and run it through a select case:
Get
select case WindDirection
case 11.25 to 33.75
Return kNorthNorthEast
case 33.75 to 56.25
return kNorthEast
case 56.25 to 78.75
return kEAstNorthEast
case 78.75 to 101.25
Return kEAst
case 101.25 to 123.75
return kEAstSouthEast
case 123.75 to 146.25
return kSouthEast
case 146.25 to 168.75
return kSouthSouthEast
case 167.75 to 191.25
return kSouth
case 192.25 to 213.75
return kSouthSouthWest
case 213.75 to 236.25
return kSouthWest
case 236.25 to 258.75
return kWestSouthWest
case 258.75 to 281.25
return kWest
case 281.25 to 303.75
return kWestNorthWest
case 303.75 to 326.25
return kNorthWest
case 326.25 to 348.75
return kNorthNorthWest
else
return kNorth
end select
End Get
Nothing very sophisticated. The returned string constants are often static constants, but all those containing “East” are dynamic constants and in case of German return an O for Ost instead of E for East, so kEastSouthEast is “ESE” as default and “OSO” in German.
I print those constants to the console and to a LCDDisplay. Strangely, in console the upper result reads like “O S O” and comes out with probably Chinese signs between each wind direction abbreviation. I tried Text constants, but the same result. Do I have to define an encoding?