Skip to main content

Datalogger Range

  1. Navigate to HSYCO Manager

Tip: We'll firstly define the WXONLINE Server and modify one parameter to retrieve the weather information from the city you want

  1. Go into "Setting"

  1. Open the "I/O Server" section

  1. Click "+" to add a new server

  1. Select "WXONLINE" from the "Type" field

  1. Give the server an ID ("weather" for example)

  1. Click "OK" to confirm

  1. Click "+" in the "Options" panel to add an attribute

  1. Select the "location" from the "Option" select

10. Put here the ID of the target location or coordinates. You can retrieve this by going in the OpenWeatherMap website ( https://openweathermap.org/ ) and search for the city you would like to get the data from. The numbers after the last '/' in the URL represents the ID of that city

  1. Click "OK" to confirm

  1. Click "Save"

  1. Click "Save" again and wait for HSYCO to restart

Tip: Now that we defined the Server, we'll create the project and assign the range data logger to a Datalogger object in the Project Editor

  1. Create a new project or open an existing one

  1. Go into the Home page

  1. Click "add"

  1. Add a "Datalogger"

  1. Resize it so that it fits the entire page

  1. Go back to "edit" mode

20. Change the "Logger ID" to "logger2". This is the ID of the range logger defined in the settings

  1. Change the "Controls" to "toolbar"

22. Change the "Type" to "spline". This draws a spline connecting the values

  1. Change the "Value Label Type" to "popup"

  1. Click "Save" to save the project

Tip: Great! Now the last thing to do is write some code that updates this Datalogger

  1. Go into the "File Manager"

  1. Navigate in the "events" folder

  1. Click "New File"

  1. Give it a name ("rangelogger.txt" for example) and click "New File"

**29. Copy the following code in the file and save it:

IO weather.temp.c or TIME : DATALOGGER logger2 = IO weather.temp.c

What this does is it updates the values for data logger with ID "logger2" with the temperature value (in Celsius) from the "weather" server. It updates it every time the temperature changes or every minute**

Tip: Now we can test it!

  1. Open the Project Editor, click "Run" and then "Default" to launch the application

  1. After some time has passed, the graph will have formed with the temperatures over time

  1. As you can see, if we hove over the graph we see the popup values

  1. The graph is a spline as we defined it in the Datalogger attributes so all the values are connected through a spline