Hello
I'm trying to make a movement detector (turn on RedLed with any movement)
with micaZ and mts310 sensor board, I already done with timers like calling
aplication checking AcceX-Y values every 1/2 sec, but i want to make a more
eficient aplication implementing events.
I finished a similar aplication (toneDetector), with MicInterrupt class and
is working perfectly, so i'm trying to do the same steps but isn't work,my
question is:
-is it possible ????
-What INT I need use 0,1,2,3 ?????
-There are something wrong in my code ????
//------------->NEW interface<------------------
interface AccelInterrupt
{
/* Effects: disable interrupts
Returns: SUCCESS
*/
async command bool disable();
/* Effects: enable interrupts
Returns: SUCCESS
*/
async command result_t enable();
async event result_t moveDetected();
}
===================================================================
--------------->CONFIG<--------------------
configuration InterruptMovement {
// this module does not provide any interface
}
implementation
{
components Main, InterruptMovementM, LedsC,SingleTimer, Accel, SysTimeM;
Main.StdControl -> InterruptMovementM.StdControl;
Main.StdControl -> SingleTimer.StdControl;
InterruptMovementM.Leds -> LedsC;
InterruptMovementM.AccelControl -> Accel;
InterruptMovementM.AccelX -> Accel.AccelX;
InterruptMovementM.AccelY -> Accel.AccelY;
InterruptMovementM.AccelInterrupt -> Accel;
InterruptMovementM.Timer -> SingleTimer.Timer;
}
===================================================================
------------------>MODULE<--------------------------------------
module InterruptMovementM
{
provides {
interface StdControl;
}
uses {
interface Leds;
interface Timer;
// Accel
interface StdControl as AccelControl;
interface ADC as AccelX;
interface ADC as AccelY;
interface AccelInterrupt;
}
}
implementation {
// implementation of StdControl interface
command result_t StdControl.init()
{
call Leds.init();
call AccelControl.init();
call AccelInterrupt.enable();
call Leds.greenOn();
return SUCCESS;
}
command result_t StdControl.start()
{
call AccelControl.start();
call Leds.greenOn();
return SUCCESS;
}
command result_t StdControl.stop()
{
call AccelControl.stop();
}
async event result_t AccelInterrupt.moveDetected()
{
call Leds.redToggle();
return call Timer.start(TIMER_ONE_SHOT, 1000);;
}
event result_t Timer.fired()
{
call AccelInterrupt.enable();
return SUCCESS;
}
async event result_t AccelY.dataReady(uint16_t data) {
return SUCCESS;
}
async event result_t AccelX.dataReady(uint16_t data) {
return SUCCESS;
}
}
Ro
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help