The Temperature Block senses the ambient temperature and presents you that information in different units of measurement (Celsius, Kelvin, Fahrenheit). This guide shows you how to use the Data Feed to read the current temperature and how to trigger actions from other blocks based on the temperature values.
Before you start, make sure you have a Power Station properly powered and a WiFi Block already activated and paired with your computer. If you are not sure how to do this, please refer to the section Activating Your WiFi Block.
- First, snap your Temperature Block to your WIFI and Power station stack, the order does not matter. A red light inside of the block should start blinking. If your WiFi Radio is paired, you should now see 3 blocks online; Power Station, WiFi (identified by its IP address) and a Temperature block. Click on the ‘Temperature’ menu item to add the block to your workspace:
- To see the data coming from the block, activate the Data Feed by clicking on the Temperature's canvas icon:
- The Data Feed is a way to visualize the information coming from hardware blocks, in this case, since the Temperature block produces 3 types of readings, the Data Feed shows 3 items, ‘Celsius’, ‘Kelvin’ and ‘Fahrenheit’:
- At this point, you are ready to use the Temperature block to trigger actions on other blocks based on the current temperature. Lets now add a ‘Sound Player’ into the canvas and connect it as a child of the Temperature block:
- Enter the Temperature’s Logic Maker by clicking the middle action icon or double-clicking on its canvas icon:
- From the Logic Maker, add an ‘Input’, ‘Greater Than’ and ‘Action’ gates. Connect them in the following way:
- From the ‘Input’ gate, select ‘Celsius’ and depending on your current temperature, change the value of the ‘Greater Than’ to something above the current Celsius readings (if your Data Feed display is not visible at this point, you can bring it up by pressing ‘Cmd+I’ on MacOS or ‘Ctrl+I’ on Windows). Finally, from the ‘Action’ gate choose the sound you want to play, in our case, we use ‘Siren’.
The logic is simple. Every time the hardware block produces data, that information is sent to your Logic Maker, the ‘Input’ gate filters the information and selects to the ‘celsius’ readings. It then sends this value down to the ‘Greater Than’ gate, which filters the data and only allows values greater than the one you specified. Thus, if the temperature rises above the threshold, the ‘Greater Than’ lets the event pass through, once it reaches the ‘Action’, it then triggers the sound you selected.
- Once your gates are connected and configured, click on ‘Apply’ to save your changes. If everything is OK, your gates should light up in blue to show the interaction between them when the Temperature block produces a new event:
Keep in mind you can have as many actions from as many Virtual Block as you wish using this pattern. For instance, you can play a sound and send an email to notify you about the rise in temperature.
NOTE: We recommend having a look at the article ‘How To Compensate Temperature Readings”.