This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Bluetooth ouput node not clearing buffer at input
I was playing with the BLE feature to integrate a laser distometer. The device can receive commands (laser on/off, continuous mode, single measurement, etc) that i managed to control with the BLE output node which is connected to a button output buffer of length 1. The issue is, that once the button has been pressed, its output buffer is filled and never cleared again. The output node will therefore repeat sending the command at each analysis cycle. Manually adding  clear="true" (and for the sake of testing, also clear="false") to the input line of the BLE output node doesn't have any effect. Also for other types of outputs that might be sent to an external device via BLE, i think "clear at input" might be a useful behavior?
Makes sense, indeed.

The current solution is to handle erasing in the analysis block. Sending BLE data is always (and only) done when the analysis cycle has finished, so you can control the data before each send. Usually, you would react to the button push by preparing the data to be sent. So, for example, your button would write the value 1 to a buffer "buttonTriggered" and in the analysis block you would copy some data to "dataToBeSent" if "buttonTriggered" equals 1 and just clear "dataToBeSent" otherwise (clear="true" at the output a type="empty" input for the else case). You can then simply unconditionally append a zero afterwards to clear the "buttonTriggered" buffer.

In your case this seems a bit awkward as you want to send the same value as set by the button. So you would do something like this, which appears unnecessarily overcomplicated as you do not need to fetch special data:

<if equal="true">
  <input clear="true">buttonTriggered</input>
  <input type="value">1</input>
  <input type="value">1</input>
  <input type="empty" />
  <output clear="true">dataToBeSend</output>

  <input type="value">0</input>

Forum Jump: