Proyecto Nivel, Edgar Ochoa, Erik Garcia

Dependencies:   MMA8451Q mbed

Committer:
through
Date:
Fri Feb 12 14:01:53 2016 +0000
Revision:
22:de1ab79df237
Parent:
10:76ab6531ba6f
Child:
25:2d2f8736f147
Child:
26:e10b8fb4e2ae
version erik 3

Who changed what in which revision?

UserRevisionLine numberNew contents of line
vikglz 9:4c0271cd6e49 1 #include "adcBasic.h"
verden32 0:cf09f0ecb330 2 #include "mbed.h"
vikglz 9:4c0271cd6e49 3 #include "MMA8451Q.h"
verden32 0:cf09f0ecb330 4 MMA8451Q acc(PTE25, PTE24);
verden32 0:cf09f0ecb330 5 PwmOut r(LED_RED);
verden32 0:cf09f0ecb330 6 PwmOut g(LED_GREEN);
verden32 0:cf09f0ecb330 7 PwmOut b(LED_BLUE);
vikglz 9:4c0271cd6e49 8 Serial pc(USBTX,USBRX);
through 22:de1ab79df237 9 float x,y,z;
verden32 0:cf09f0ecb330 10
vikglz 9:4c0271cd6e49 11
vikglz 9:4c0271cd6e49 12
verden32 0:cf09f0ecb330 13 int16_t data[3];
verden32 0:cf09f0ecb330 14 int main() {
verden32 0:cf09f0ecb330 15
verden32 0:cf09f0ecb330 16 pc.baud(9600); //velocidad serial//
verden32 0:cf09f0ecb330 17 pc.format(8,SerialBase::None ,1) ;
verden32 0:cf09f0ecb330 18 pc.putc(65);
vikglz 9:4c0271cd6e49 19 mensaje();
verden32 0:cf09f0ecb330 20 while(1) {
verden32 0:cf09f0ecb330 21
verden32 0:cf09f0ecb330 22 acc.getAccAllAxis(data);
through 10:76ab6531ba6f 23
through 22:de1ab79df237 24 z = 1.0 - abs(data[0]/16500.0);
through 22:de1ab79df237 25 y = 1.0 - abs(data[1]/16500.0);
through 22:de1ab79df237 26 x = 1.0 - abs(data[2]/16500.0);
verden32 0:cf09f0ecb330 27
verden32 0:cf09f0ecb330 28
verden32 0:cf09f0ecb330 29 pc.printf("%d,%d,%d,\n",data[0],data[1],data[2]);
verden32 0:cf09f0ecb330 30
verden32 0:cf09f0ecb330 31 wait(0.4);
verden32 0:cf09f0ecb330 32
verden32 0:cf09f0ecb330 33 }
verden32 0:cf09f0ecb330 34
verden32 0:cf09f0ecb330 35 }
verden32 0:cf09f0ecb330 36
vikglz 1:f15981c66b73 37
vikglz 2:435a2b33e092 38 //Hola Mundo!!! jajajaja
vikglz 9:4c0271cd6e49 39 //otro cambio