Edgar Ochoa
/
ProyectoNivel
Proyecto Nivel, Edgar Ochoa, Erik Garcia
main.cpp@26:e10b8fb4e2ae, 2016-02-12 (annotated)
- Committer:
- verden32
- Date:
- Fri Feb 12 14:43:46 2016 +0000
- Revision:
- 26:e10b8fb4e2ae
- Parent:
- 22:de1ab79df237
- Child:
- 27:85d44b207258
final parte 1
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); |
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); |
verden32 | 26:e10b8fb4e2ae | 19 | |
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 | 26:e10b8fb4e2ae | 27 | Mensajes(); |
verden32 | 26:e10b8fb4e2ae | 28 | erik_nivel(); |
verden32 | 0:cf09f0ecb330 | 29 | |
verden32 | 26:e10b8fb4e2ae | 30 | |
verden32 | 0:cf09f0ecb330 | 31 | |
verden32 | 0:cf09f0ecb330 | 32 | wait(0.4); |
verden32 | 0:cf09f0ecb330 | 33 | |
verden32 | 0:cf09f0ecb330 | 34 | } |
verden32 | 0:cf09f0ecb330 | 35 | |
verden32 | 0:cf09f0ecb330 | 36 | } |
verden32 | 0:cf09f0ecb330 | 37 | |
vikglz | 1:f15981c66b73 | 38 | |
vikglz | 2:435a2b33e092 | 39 | //Hola Mundo!!! jajajaja |
vikglz | 9:4c0271cd6e49 | 40 | //otro cambio |