Edgar Ochoa
/
ProyectoNivel
Proyecto Nivel, Edgar Ochoa, Erik Garcia
main.cpp@4:968d1e655757, 2016-02-10 (annotated)
- Committer:
- through
- Date:
- Wed Feb 10 18:55:06 2016 +0000
- Revision:
- 4:968d1e655757
- Parent:
- 3:5ddc4aaeffe7
- Child:
- 5:8fcc1b94a287
- Child:
- 6:7544bfc8d3d4
- Child:
- 11:b00537c9e458
ya llegu?, atte: erik
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
verden32 | 0:cf09f0ecb330 | 1 | #include "mbed.h" |
verden32 | 0:cf09f0ecb330 | 2 | #include "MMA8451Q.h" |
verden32 | 0:cf09f0ecb330 | 3 | MMA8451Q acc(PTE25, PTE24); |
verden32 | 0:cf09f0ecb330 | 4 | PwmOut r(LED_RED); |
verden32 | 0:cf09f0ecb330 | 5 | PwmOut g(LED_GREEN); |
verden32 | 0:cf09f0ecb330 | 6 | PwmOut b(LED_BLUE); |
verden32 | 0:cf09f0ecb330 | 7 | |
verden32 | 0:cf09f0ecb330 | 8 | Serial pc(USBTX,USBRX); |
verden32 | 0:cf09f0ecb330 | 9 | int16_t data[3]; |
verden32 | 0:cf09f0ecb330 | 10 | int main() { |
verden32 | 0:cf09f0ecb330 | 11 | |
verden32 | 0:cf09f0ecb330 | 12 | pc.baud(9600); //velocidad serial// |
verden32 | 0:cf09f0ecb330 | 13 | pc.format(8,SerialBase::None ,1) ; |
verden32 | 0:cf09f0ecb330 | 14 | pc.putc(65); |
verden32 | 0:cf09f0ecb330 | 15 | |
verden32 | 0:cf09f0ecb330 | 16 | while(1) { |
verden32 | 0:cf09f0ecb330 | 17 | |
verden32 | 0:cf09f0ecb330 | 18 | acc.getAccAllAxis(data); |
verden32 | 0:cf09f0ecb330 | 19 | |
verden32 | 0:cf09f0ecb330 | 20 | r = 1.0 - abs(data[0]/16500.0); |
verden32 | 0:cf09f0ecb330 | 21 | g = 1.0 - abs(data[1]/16500.0); |
verden32 | 0:cf09f0ecb330 | 22 | b = 1.0 - abs(data[2]/16500.0); |
verden32 | 0:cf09f0ecb330 | 23 | |
verden32 | 0:cf09f0ecb330 | 24 | |
verden32 | 0:cf09f0ecb330 | 25 | pc.printf("%d,%d,%d,\n",data[0],data[1],data[2]); |
verden32 | 0:cf09f0ecb330 | 26 | |
verden32 | 0:cf09f0ecb330 | 27 | wait(0.4); |
verden32 | 0:cf09f0ecb330 | 28 | |
verden32 | 0:cf09f0ecb330 | 29 | } |
verden32 | 0:cf09f0ecb330 | 30 | |
verden32 | 0:cf09f0ecb330 | 31 | } |
verden32 | 0:cf09f0ecb330 | 32 | |
vikglz | 1:f15981c66b73 | 33 | |
vikglz | 2:435a2b33e092 | 34 | //Hola Mundo!!! jajajaja |
verden32 | 3:5ddc4aaeffe7 | 35 | //otro cambio |
through | 4:968d1e655757 | 36 | //pues no he cambiado nada pero hay vamos jaja |
through | 4:968d1e655757 | 37 | //ya llegué mundo, atte:erik |