2026-05-05 11:17 AM - last edited on 2026-05-07 1:49 AM by Andrew Neil
Split from Sensor TileBox Pro - orientation of X,Y,Z axes ? - this is a new question.
Ok, so I will go with what I measured.
I have the output from MEMS Studio for temperature. It says the temperature is 32.18C, which is 0x0c90
There is no such hex value in the entire file and so I am wondering how mems studio got the value file attached
2026-05-06 7:54 PM - edited 2026-05-06 7:57 PM
private static int ReadTemperatureDataFiles(string[] files, double Delta, ref double Temperature, StreamWriter sw)
{
Console.WriteLine("\n\r Reading the Temperature data files from the ST Sensor Tile Box..." +
"\n\r\n\r Byte Offset Number Time Byte Value Temperature" +
"\n\r [16] Seconds [2] C \n\r");
byte[] fileBytes = File.ReadAllBytes(files[2]);
byte[] byteArray1A = new byte[16];
var len = (int)fileBytes.Length;
int num = fileBytes.Length / 16;
for (int it = 1; it < len; it += 16)
{
byte[] byteT = [fileBytes[it + 3], fileBytes[it + 4], fileBytes[it + 5], fileBytes[it + 6]]; // Example byte array
float resultT = BitConverter.ToSingle(byteT); // Converts 4 bytes starting at index 0
double timeValue = Convert.ToDouble(resultT); // Convert to seconds
}
return 0;
}A long time ago in another life, I once spent a week sorting out one line of AutoLISP Code. I can remember the joy at cracking the problem. AutoLISP made my team a lot of money.
This temperature dat problem from the Sensor TileBox Pro has been as hard. I finally cracked the problem when I was annoyed and playing with the Hex Editor and found that if I clicked on float the blasted answer of 32.18 appeared, three hours later I worked out how to code it in C#.
So someone else does not die on the cross of programming, here is the code.
I was missing Line 15, I had it as int with a value in the millions but not a single. Fortran is easier.
Anyway time for the end of the day.
(I just noticed the error and I will fix it tomorrow.)