Hello,
It would be nice if you could help out.
I have editted the source code for XMDA300M.nc.
There is a part where "data" variable is used to record down the
output voltage produced by the sensors.
I am using a LM35CZ temperature sensor, which produce 10mV of voltage
for each Centrigade(celcius). Therefore, for 30 Celcius, reading is
0.3 in MoteView (10mV * 30). However, when i want to compare the
reading in the coding, it seens that when
i want to compare the value between the output voltage, it differs.
reading in MoteView = 0.27
threshold value = data < 320 (which i assume is in mV).
if output of sensor <320, timer_rate =1 secs, >320, timer_rate = 5secs.
In this case, when output voltage is 0.27, the timer_rate is 1secs.
My question here is, what does the "data" variable represents? Is
there any conversion formula for it?
=========================================================
*******************************************************************************************
event result_t
Sample.dataReady(uint8_t channel,uint8_t channelType,uint16_t data)
{
switch (channelType) {
case ANALOG:
switch (channel) {
// MSG 1 : first part of analog channels (0-6)
case 0:
tmppack=(XDataMsg *)packet.data;
tmppack->xData.datap6.adc0 =data ;
atomic {msg_status|=0x01;}
break;
case 1:
tmppack=(XDataMsg *)packet.data;
tmppack->xData.datap6.adc1 =data ;
atomic {msg_status|=0x02;}
break;
case 2:
tmppack=(XDataMsg *)packet.data;
tmppack->xData.datap6.adc2 =data ;
if(data>320)
timer_rate = 1000; //2secs
call Timer.stop();
call Timer.start(TIMER_REPEAT, timer_rate);
if(data<320)
timer_rate = 5000; //2secs
call Timer.stop();
call Timer.start(TIMER_REPEAT, timer_rate);
atomic {msg_status|=0x04;}
break;
default:
break;
} // case ANALOG (channel)
break;
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help