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