Lab 3ES_ John Curran T00214119

Dependencies:   mbed MMA7660

main.cpp

Committer:
johnc89
Date:
2021-04-17
Revision:
3:7380a26ac26f
Parent:
0:bd0546063b0a
Child:
4:efd9328bb9f0

File content as of revision 3:7380a26ac26f:

//Uses the measured z-acceleration to drive leds 2 and 3 of the mbed

#include "mbed.h"
#include "MMA7660.h"
Serial pc(USBTX,USBRX);// serial communications
MMA7660 MMA(p28, p27);

DigitalOut connectionLed(LED1);
PwmOut Zaxis_p(LED2);
PwmOut Zaxis_n(LED3);

int main() {  
    if (MMA.testConnection())
        connectionLed = 1;
        
    while(1) {
        pc.printf ("%f, %f, %f \r\n", MMA.x(), MMA.y(), MMA.z() );
        wait (0.5);
    }

}