Aidan Cleary / Mbed 2 deprecated ESlab3

Dependencies:   mbed MMA7660

main.cpp

Committer:
hellohello
Date:
2021-05-03
Revision:
3:9ea256470c8a
Parent:
0:bd0546063b0a
Child:
4:c3bb91b3b992

File content as of revision 3:9ea256470c8a:


//embedded systems lab question 3 Aidan Cleary T00209564
//Lab 3: Digital sensors & equations in C

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

#include "mbed.h"
#include "MMA7660.h"

MMA7660 MMA(p28, p27);

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

int main()
{
    if (MMA.testConnection())
        connectionLed = 1;

    while(1) {
        Zaxis_p = MMA.z();
        Zaxis_n = -MMA.z();
    }

}