This page has no translation to 中文 yet. The original English version is below. If you’d like to help, great! See how to translate a documentation page in the contribution guide.
Note This is a web-version of a tutorial chapter embedded right into the XOD IDE. To get a better learning experience we recommend to install the desktop IDE or start the browser-based IDE, and you’ll see the same tutorial there.

Feed Messaging

Screenshot of 111-feed-messaging

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.

Excercise #

  1. Bind a proper PORT to the servo node
  2. Upload the program with the debug mode turned on.
  3. Update tweak-number value and check out how your servo responds.
  4. Place a 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.

Found a typo or mistake? Want to improve the text? Edit this page on GitHub and open a pull request. If you have a complex proposal or you want to discuss the content, feel free to start a new thread on XOD forum.