Component: BBC Weather Forecast (Comms: IoT/Cloud)

From Flowcode Help
Jump to: navigation, search


Author MatrixTSL
Version 1.0 (Release)
Category Comms: IoT/Cloud


Contents

Image BBC Weather Forecast component

Easily allows you to collect three day forecasted weather metrics for your area using the BBC Weather data service. Supports Min/Max temperature, Wind Direction, Wind Speed, Visibility, Pressure, Humidty, UV Risk, Pollution and Sun Rise/Set times for your selected area.

Examples

Here is a basic example to read the three day forecast data and report the information on a graphical display.

FC6 Icon.png BBCWeatherForecastDemo


The location can be set by adjusting the BBC Weather location property, see the component property tooltips for more information on how to do this.

On an embedded device you would need a TCP/IP component to allow the communications to the BBC server. This then links to the Network Comms component.

Downloadable macro reference

GetDaySummary

Gets the summary of the currently selected day as a string.

Parameters

This macro has no parameters


Return value

STRING


GetMaxTemperature

Reads the forecast maximum temperature in the selected scale for the selected day.

Parameters

BOOL Scale
0 = Celcius, 1 = Farenheit


Return value

INT


GetVisibility

Reads the forecast visibility for the selected day.

Parameters

This macro has no parameters


Return value

STRING


GetMinTemperature

Reads the forecast minimum temperature in the selected scale for the selected day.

Parameters

BOOL Scale
0 = Celcius, 1 = Farenheit


Return value

INT


GetWindDirection

Reads the forecast wind direction as a string for the selected day.

Parameters

This macro has no parameters


Return value

STRING


RequestData

Requests data about your selected location from the BBC weather service.

Returns true if the request was successful.

Must be called before trying to call any of the GetXXX macros.

Parameters

This macro has no parameters


Return value

BOOL : Returns true if the operation is a success, else false


GetPollution

Reads the forecast pollution as a string for the selected day.

Parameters

This macro has no parameters


Return value

STRING


GetSunset

Reads the forecast sunset time as a string for the selected day.

Parameters

This macro has no parameters


Return value

STRING


GetHumidity

Reads the forecast humidity in Relative Humdity for the selected day.

Parameters

This macro has no parameters


Return value

BYTE


GetDayName

Gets the name of the currently selected day as a string.

Parameters

This macro has no parameters


Return value

STRING


GetWindSpeed

Reads the reported wind speed in MPH for the selected day.

Parameters

This macro has no parameters


Return value

BYTE


SetLocationCode

Allows the location code to be altered from the default location code set in the component properties.

After changing the location the RequestData macro must be called to refresh the forecast variables.

Parameters

<- STRING NewLocation
New location string, see Location property tooltip for more info.
This parameter may be returned back to the caller


Return value

This call does not return a value


GetSunrise

Reads the forecast sunrise time as a string for the selected day.

Parameters

This macro has no parameters


Return value

STRING


GetPressure

Reads the forecast air pressure in milli bar (mb) for the selected day.

Parameters

This macro has no parameters


Return value

UINT


SetForecastDay

Chooses which day of the three day forecast to look at.

Parameters

BYTE Day
0 = Today, 1 = Tomorrow, 2 = Day After Tomorrow


Return value

This call does not return a value


GetUVRisk

Reads the forecast UV Risk for the selected day.

Parameters

This macro has no parameters


Return value

BYTE


GetLocationName

Reads the reported location name as a string.

Parameters

This macro has no parameters


Return value

STRING


Initialise

Sets up the component ready to collect weather data.

Parameters

This macro has no parameters


Return value

This call does not return a value


Simulation macro reference

This component does not contain any simulation macros


Property reference

Network Comms Component

This property is of type Panel object and can be referenced with the variable name NetworkCommsComp.

Network Communications component to use as the bridge to the TCP/IP network.

BBC IP Address

This property is of type Line of text and can be referenced with the variable name IPAddr.

IP Address linked to the following URL: weather-broker-cdn.api.bbci.co.uk

Location Code

This property is of type Line of text and can be referenced with the variable name Location.

BBC code for your area.

In a web browser go to www.bbc.co.uk/weather/

Then type in your city in the search bar and your code will be shown at the end of the URL.

For example Manchester in the UK = 2643123

In the UK you can also use the first half of your post code, e.g. HX1

Receive Timeout

This property is of type Unsigned integer and can be referenced with the variable name RxTimeout.

Maximum time to wait for valid incoming data.

Personal tools