Clarification on "setValue" methods

There are two different ways to send data over blinks’ IR links - one that sends a small value (0-63) continuously and one that sends a potentially larger amount of data (up to 16 bytes) one time and only one time.

The continuous send functions are setValueSentOnFace() and setValueSentOnAllFaces(). Once you call one of these, the specified value is sent over and over again as quickly as possible (typically many times per second) over the IR link until you update the sent value with another call to setValueSentOnFace(). This is a great way to share state information.

The one-time send function is sendDatagramOnFace(). When you call that, the specified data is sent one time on that face. This send is best-efforts only so if, say, there is no other blink attached to that face then the sent datagram message is lost forever. This is similar to how UDP datagrams work on Ethernet.

Note that these IR send method are independent of each other, so there are separate receive functions. Sending a datagram does not change the setValueSentOnFace() value, or vice versa (although the repeated setValueSentOnFace() sending is paused for a split second while the datagram is send completes).

Also note that once a datagram has been sent, that face will go back to continuously sending whatever the last setValueSentOnFace() value was.

Does this clear things up?

3 Likes