Hi everyone,

I am reading temperature and relative humidity data using SHT11 and micaz
over the sensor network. The sensor readings are supposedly in float (this
is the code snippet of my main application program:

  event void TempReading.readDone(error_t result, uint16_t data) {
    const float d1 = -39.60;
    const float d2 = 0.01;

    if (result != SUCCESS)
      {
    data = 0xffff;
    report_problem();
      }
    data = (d1 + d2*data);
    local.temperature[reading] = data;
  }

but what is printed are only integer values (decimal/ mantissa values are
truncated???)

/opt/tinyos-2.1.0/apps/MotesArt_LiTe$ java net.tinyos.tools.MsgReader
MotesArtMsg
serial@/dev/ttyUSB1:57600: resynchronising
1269161108071: 1 31.0 61.0 571 RSSI

1269161109058: 1 31.0 61.0 573 RSSI

1269161110058: 1 31.0 61.0 574 RSSI

1269161111057: 1 31.0 61.0 575 RSSI

I observe that data are sent in the network in uint16_t data type. Is this
similar to float or how can I change this data type into a float?
Please help me.

Mark Patrick Cabrera
_______________________________________________
Tinyos-help mailing list
Tinyos-help@millennium.berkeley.edu
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to