In this chapter, we’ll make an analog gauge for the data that is pushed to the cloud in the same way you already saw in one of the previous chapters.
The xod-cloud/feeds
standard library provides nodes to retrieve the last value from your feed with different types: cloud-boolean
, cloud-string
, and cloud-number
. Since we’re sending number values, we pick cloud-number
.
On the left side, nodes react to the data changes by rotating a servo. On the right side, you see nodes to update the value and check out how your servo responds.
Note that on both sides, we named the feed as “moisture”, they should match. Usually, the moisture is measured as a percentage. So we expect values in a range from 0.00 to 1.00. If you use another range, place the map
node before the VAL
input of a servo
node.
PORT
to the servo
nodetweak-number
value and check out how your servo responds.map
node between cloud-number
and servo
if needed.Now you got a remote analog gauge for the data that you send to the cloud. You can place it on your desktop and watch for the moisture in your greenhouse located far away.
You might build another device to switch a water pump in response to the same data feed changes. Moreover, you could send the status of the water pump to the cloud to see if the pump is working.
Use the tweak-number
node to update the value.