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.

Phyphox editor Button send single value
I am testing the button functionality. Is it possible that when you click the button it sends a value only once. I tried creating a button that sends a value to a BLE Characteristic but the value is sent continously. Is there an example (xml) of how to send a value only once when the button is pressed?

unfortunately there is no simple way right now (its already on our todo list). As a workaround you can do it this way:
  • if a button is pressed, write a 1 into a data-pressed-buffer
  • an if-statement checks each analysis round if the data-pressed-buffer contains an 1
  • if true: write the data you would like to transfer into the outgoing buffer
  • if false: empty the outgoing buffer (if the outgoing buffer is empty - no data will be sent via ble) 
  • (re)set the data-pressed-buffer to 0 to prevent furter data transfers until the button was pressed again

Hope this is not too confusing Wink. As an example, check the attached phyphox-file which lets the user select different measurement intervals of an external sensor module. 

Cheers Dominik

Attached Files
.phyphox   MPRLS_configurable.phyphox (Size: 4.92 KB / Downloads: 30)
Thanks for the example so if I understand correctly the value I have circled in blue has to be the same on the following image: And then the "Action1" is the value I can send a singleshot (e.g. 100 or 200 for this picture)

[Image: fSQfQrB.png]
Dominik is currently busy with a … sort-of other hardware project, so I try to get the answer right:

First, please be careful with ordering the boxes in the analysis tab: they are processed from left to right (and in addition the editor complains that it does not entirely support Dominik's file, see the if element documentation)…

Judging from the if element the “1”s in the button elements can by anything but “0”. The “1” in the middle append element is part of the communication with the microcontroller and its meaning is defined there, so it has –just reading the .phyphox file– nothing to do with the previous “1”s.

Note that in your image this append element would be processed after the if block and, accordingly, it would not stop bluetooth communication. Same holds for the left append element: you should place it right of the if element (so that it is put below it in the .phyphox file) or the reset would not work…
Thanks for the answer. After struggling to use the editor (due to the multiple inputs warning) I managed to make it work for my experiment. I couldnt replicate this in the editor but had to copy fragmens of the xml provided by Dominik to make it work.

I think this still would be a nice feature as currently it took me a while to understand how to use the button for my use case.

Thanks and best regards.
(10-27-2022, 05:26 PM)vcbz Wrote: I think this still would be a nice feature as currently it took me a while to understand how to use the button for my use case.

Indeed. Unfortunately one of many… Wink

For the moment, it appears more likely that our new editor is ready.

Forum Jump: