BGS5T Sending hex values trought RS232 | Telit Cinterion IoT Developer Community
November 10, 2014 - 1:32pm, 2271 views
I have 1-wire temperature sensor on RS232. I have to send and receive hex values to communicate with it. I managed to send String values through it, but I have no success with the sensor. If I communicate with sensor directly through computer I get some response values but none when I use RS232 on the module.
Here is my code: http://pastebin.com/72V2NuKK
Can somebody please check if this is correct for sending hex values?
Best regards
Jure
I managed to found solution by my self. I converted hex values directly to binary, Here is sample if anyone will need it. Instead of this:
String C1 = "193";
I am doing like this:
byte bC1 = (byte)Integer.parseInt("11000001",2);
byte bparameter2 = (byte)Integer.parseInt("00010111",2);
byte bparameter3 = (byte)Integer.parseInt("01000101",2);
byte bparameter4 = (byte)Integer.parseInt("01011011",2);
byte bparameter5 = (byte)Integer.parseInt("00001111",2);
byte bparameter6 = (byte)Integer.parseInt("10010101",2);
byte[] bArray = {bparameter2,bparameter3,bparameter4,bparameter5,bparameter6};
Regards
Jure