Hi,

I'm trying to sample simultaneusly and continuosly X and Y axis of a MTS310, 
but I can read only one axis per time. I'm using MicaZ with Tinyos 2.0.2. 
I see that the sampling of  Y axis starts only when readDone event
of  X axis is signalled, but with a continuos reading this event will be never 
signalled.
Is this a known problem or there's another way to read the accelerometer?

Thanks in advance.
Stefano

My code to read the accelerometer is:

Configuration:
  components new AccelXStreamC() as LetturaX;
  components new AccelYStreamC() as LetturaY;
  App.LetturaX -> LetturaX;
  App.LetturaY -> LetturaY;


Implementation:
command void Start.start() {
    call LetturaX.postBuffer(&dati1,SIZE);
    call LetturaX.postBuffer(&dati2,SIZE);
    call LetturaX.read(INTERVAL);

    call LetturaY.postBuffer(&dati3,SIZE);
    call LetturaY.postBuffer(&dati4,SIZE);
    call LetturaY.read(INTERVAL);
}

  event void LetturaX.bufferDone(error_t result,uint16_t* buf,uint16_t count){
    if(result == SUCCESS){
      fillx = buf;
      post RiempimentoX();
    }
    if(dat1){
      dat1 = FALSE;
      dat2 = TRUE;
      call LetturaX.postBuffer(&dati1,SIZE);
    }else{
      dat1 = TRUE;
      dat2 = FALSE;
      call LetturaX.postBuffer(&dati2,SIZE);
    }
  }

  event void LetturaX.readDone(error_t result,uint32_t usActualPeriod){} 

  event void LetturaY.bufferDone(error_t result,uint16_t* buf,uint16_t count){
    if(result == SUCCESS){
      filly = buf;
      post RiempimentoY();
    }
    if(dat3){
      dat3 = FALSE;
      dat4 = TRUE;
      call LetturaY.postBuffer(&dati3,SIZE);
    }else{
      dat3 = TRUE;
      dat4 = FALSE;
      call LetturaY.postBuffer(&dati4,SIZE);
    }
  }

  event void LetturaY.readDone(error_t result,uint32_t usActualPeriod){} 


      ___________________________________ 
Scopri il Blog di Yahoo! Mail: trucchi, novità, consigli... e la tua opinione!
http://www.ymailblogit.com/blog/
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to