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.

Converting 20-byte int16 into 10 little endian values
#1
Photo 
Hi there,

I am writing an experiment with a BLE characteristic that indicates 20-byte int16 values at once. I am trying to convert them into 10 little-endian values but I am struggling to do so using the phyphox editor as I have no experience with XML  Huh

I've tried setting the length to 20 bytes (shown in picture) but it seems to be only converting the first two bytes.

Could someone point me in the right direction please? Much appreciated!! 
   
Reply
#2
Hi hpm,

the output tags for bluetooth input do not support arrays, so you need to individually define each of the 10 values. The offset attributes have to be altered accordingly. (0, 2, 4, … for two byte values).

HTH
Reply
#3
(09-09-2021, 06:51 PM)Jens Noritzsch Wrote: Hi hpm,

the output tags for bluetooth input do not support arrays, so you need to individually define each of the 10 values. The offset attributes have to be altered accordingly. (0, 2, 4, … for two byte values).

HTH

Hi Jens, 

Thank you so much for the reply,

I have tried to individually define each of the 10 values where each value is representing an acceleration reading that I gathered. I am now able to generate these acceleration values successfully, but when I tried to add a time value to each of the 10 readings I encountered some more problems.

I generated the first time value by setting the 'extra' field in one of the output buffers to 'time'. For generating time values for the rest of the 9 acceleration readings I tried adding a small time increment each time (0.001 second) using the 'ramp' module. Then when I tried to plot the acceleration readings against time values I get really weird results as shown in the picture. The time values generated seemed to be repeating themselves and my guess was that there's something wrong with clearing the buffers. So I tried various combinations of clearing the buffers but none of them seemed to be working. 

Would you mind pointing me in the right directions again on how to add time values in the editor please? Thank you again for helping me!!

I have also attached my phyphox experiment file here if it helps.
   
   

.phyphox   nrf52_with_10byte_buffer.phyphox (Size: 9.88 KB / Downloads: 415)
Reply
#4
These have been busy two days. There should be time to look into it tomorrow/Tuesday. Could you add an export block and provide us the collected data?
Reply
#5
Please note that your analysis block continuously runs even if there is no new data. I am not yet entirely sure of the consequences for the graph. A .csv of the data could really help.

BTW, there is now a “repeating” attribute in the “input” element for such cases, see https://phyphox.org/wiki/index.php?title...Low_Energy, however, it is not (yet?) supported in the editor.
Reply


Forum Jump: