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?
Phyphox editor Button send single value
|
10-21-2022, 06:20 PM
Hey,
unfortunately there is no simple way right now (its already on our todo list). As a workaround you can do it this way:
Hope this is not too confusing . As an example, check the attached phyphox-file which lets the user select different measurement intervals of an external sensor module. Cheers Dominik
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)
10-27-2022, 02:40 PM
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…
10-27-2022, 05:26 PM
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, 09:30 PM
12-12-2022, 12:38 PM
(10-27-2022, 05:26 PM)vcbz Wrote: 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. Hi, I also want to do the same, send different values one time with the use of the edit but can't make it work in the editor. Also with the xml I am struggling so if you could help me out which lines are of interest in the xml it would help me a lot!
12-14-2022, 12:42 PM
The relevant parts are the four “button” elements and the three elements at the end of the analysis part: “append”, “if”, and “append”. The first “append” fills the BLE data, the “if” erases this data unless a button is pressed, and the second “append” resets the button press indicator (these elements are documented in our wiki at “Analysis modules”).
Of course, you also need to define the corresponding containers and the output “bluetooth” element… |
« Next Oldest | Next Newest »
|