Edgar Ochoa
/
ProyectoNivel
Proyecto Nivel, Edgar Ochoa, Erik Garcia
main.cpp@10:76ab6531ba6f, 2016-02-10 (annotated)
- Committer:
- through
- Date:
- Wed Feb 10 19:53:14 2016 +0000
- Revision:
- 10:76ab6531ba6f
- Parent:
- 9:4c0271cd6e49
- Child:
- 22:de1ab79df237
nueva version erik
Who changed what in which revision?
User | Revision | Line number | New 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); |
verden32 | 0:cf09f0ecb330 | 9 | |
vikglz | 9:4c0271cd6e49 | 10 | |
vikglz | 9:4c0271cd6e49 | 11 | |
verden32 | 0:cf09f0ecb330 | 12 | int16_t data[3]; |
verden32 | 0:cf09f0ecb330 | 13 | int main() { |
verden32 | 0:cf09f0ecb330 | 14 | |
verden32 | 0:cf09f0ecb330 | 15 | pc.baud(9600); //velocidad serial// |
verden32 | 0:cf09f0ecb330 | 16 | pc.format(8,SerialBase::None ,1) ; |
verden32 | 0:cf09f0ecb330 | 17 | pc.putc(65); |
vikglz | 9:4c0271cd6e49 | 18 | mensaje(); |
verden32 | 0:cf09f0ecb330 | 19 | while(1) { |
verden32 | 0:cf09f0ecb330 | 20 | |
verden32 | 0:cf09f0ecb330 | 21 | acc.getAccAllAxis(data); |
through | 10:76ab6531ba6f | 22 | |
verden32 | 0:cf09f0ecb330 | 23 | r = 1.0 - abs(data[0]/16500.0); |
verden32 | 0:cf09f0ecb330 | 24 | g = 1.0 - abs(data[1]/16500.0); |
verden32 | 0:cf09f0ecb330 | 25 | b = 1.0 - abs(data[2]/16500.0); |
verden32 | 0:cf09f0ecb330 | 26 | |
verden32 | 0:cf09f0ecb330 | 27 | |
verden32 | 0:cf09f0ecb330 | 28 | pc.printf("%d,%d,%d,\n",data[0],data[1],data[2]); |
verden32 | 0:cf09f0ecb330 | 29 | |
verden32 | 0:cf09f0ecb330 | 30 | wait(0.4); |
verden32 | 0:cf09f0ecb330 | 31 | |
verden32 | 0:cf09f0ecb330 | 32 | } |
verden32 | 0:cf09f0ecb330 | 33 | |
verden32 | 0:cf09f0ecb330 | 34 | } |
verden32 | 0:cf09f0ecb330 | 35 | |
vikglz | 1:f15981c66b73 | 36 | |
vikglz | 2:435a2b33e092 | 37 | //Hola Mundo!!! jajajaja |
vikglz | 9:4c0271cd6e49 | 38 | //otro cambio |