I'm want to actuate the relay present in MDA300 from 1(high) to 0(low) i.e i
want to change the state of relay.
I want to change the state of the relay when the external sensor value
exceeds a threshold(say some voltage).
how can it be done in XMDA300M.nc file?
where should i put my threshold value in the coding in order to change the
state of relay in MDA300?
Is there any Command to actuate the relay when the analog channels exceeds a
threshold value.?
Is the coding below appropriate for this purpose?
If so where should i modify?
event result_t XCommand.received(XCommandOp *opcode) {
switch (opcode->cmd) {
case XCOMMAND_SET_RATE:
// Change the data collection rate.
timer_rate = opcode->param.newrate;
call Timer.stop();
call Timer.start(TIMER_REPEAT, timer_rate);
break;
case XCOMMAND_ACTUATE:
// Change Relay's status
if(opcode->param.actuate.device==XCMD_DEVICE_RELAY1)
{
if(opcode->param.actuate.state == XCMD_STATE_OFF){ call
relay_normally_open.close();}
else if(opcode->param.actuate.state == XCMD_STATE_ON){call
relay_normally_open.open();}
else if(opcode->param.actuate.state == XCMD_STATE_TOGGLE){
// call relay_normally_open.toggle();
if (test != 0) {
test=0;
call relay_normally_closed.toggle();
}
else {
test=1;
call relay_normally_open.toggle();
}
}
}
if(opcode->param.actuate.device==XCMD_DEVICE_RELAY2)
{
if(opcode->param.actuate.state == XCMD_STATE_OFF){ call
relay_normally_closed.close();}
else if(opcode->param.actuate.state == XCMD_STATE_ON){call
relay_normally_closed.open();}
else if(opcode->param.actuate.state == XCMD_STATE_TOGGLE){
// call relay_normally_closed.toggle();
if (test != 0) {
test=0;
call relay_normally_closed.toggle();
}
else {
test=1;
call relay_normally_open.toggle();
}
}
}
break;
--
NELSON ROSARIO
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help