Convert an array of hex values to 1 byte character to use in processing IDE #11470
Replies: 5 comments 7 replies
-
I think you want |
Beta Was this translation helpful? Give feedback.
-
The MAX30001 is connected to the RP2040 to collect the ECG data. The data collected is then sent to the processing for plotting. The format in which it is sent is as follows: ecg_sample = ecg.to_bytes(4,'big')
bioz_sample = bioz.to_bytes(4,'big') Header: data_packet_header = [0x0A, 0xFA, 0x0C, 0x00, 0x02] data_packet[0] = ecg_sample[0]
data_packet[1] = ecg_sample[1]
data_packet[2] = ecg_sample[2]
data_packet[3] = ecg_sample[3]
data_packet[4] = bioz_sample[0]
data_packet[5] = bioz_sample[1]
data_packet[6] = bioz_sample[2]
data_packet[7] = bioz_sample[3]
data_packet[8] = 0xFF
data_packet[9] = 0x00
data_packet[10] = 0x00
data_packet[11] = 0x00 Footer: data_packet_footer = [0x00, 0x0B] The data is streamed to the processing in the following manner for i in range(0,len(data_packet_header)):
print(data_packet_header[i])
for i in range(0,len(data_packet)):
print(data_packet[i])
for i in range(0,len(data_packet_footer)):
print(data_packet_footer[i]) It appears to me the data is not getting streamed to the processing in the form of bytes. |
Beta Was this translation helpful? Give feedback.
-
I am facing the same issue as this link. Tried using |
Beta Was this translation helpful? Give feedback.
-
Python's
Here are the results on my CPython (Ubuntu 22.04) (Note- i made sure to flush the
This ran on my RP2040, ESP32C3, and Samd51 (WIO Terminal). My SAMD21 does not support
` |
Beta Was this translation helpful? Give feedback.
-
yes.. I did observe that the |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
data_packet_header = [0x0A, 0xFA, 0x0C, 0x00, 0x02] is the array that I need to send to the processing IDE.
In processing IDE, the data is recieved in the following manner
inString = blePort.readChar();
pcProcessData(inString);
I have converted the data_packet_header into a array of 1byte using:
struct.pack('>B',data_packet_header[i])
resulting in [b'\n', b'\xfa', b'\x0c', b'\x00' , b'\x02']But when printing the input data in Processing IDE, its not taking b'\n' as 1 char. instead its receiving b , ' ,\ , n , ' separately.
Can I get some help on this?
Beta Was this translation helpful? Give feedback.
All reactions