Projet S5 Info / Mbed 2 deprecated projet_accel

Dependencies:   mbed-rtos mbed

Fork of projet_accel by APP Team

collector.cpp

Committer:
trixrabbit
Date:
2014-03-20
Revision:
0:1e7ffdb6d1db
Child:
1:761ea6f346ab

File content as of revision 0:1e7ffdb6d1db:

#include "main.h"

DigitalIn bouton(p7); 
int x,y,z,c; 
bool release;
std::vector<int> x_array;
std::vector<int> y_array;
std::vector<int> z_array;

Serial pc(USBTX, USBRX);    // PC serial communication 

void collector_thread(void const *args)
{
        while(1)
        {
            if(bouton)
            {
            
            release = true;
            x_array[c] = getAccelValue(OUT_X_MSB); 
            y_array[c]= getAccelValue(OUT_Y_MSB); 
            z_array[c]= getAccelValue(OUT_Z_MSB);
            c++;
            }
          else{
              if(release == true)
                 {
                  
                  pc.printf("bouton release");
                    
                  pc.printf("d% ", x_array[0]);
                  release = false;
                  c = 0;
                 }
              }
      }
}