Hello World program for MMA7660

Dependencies:   MMA7660 mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 //Uses the measured z-acceleration to drive leds 2 and 3 of the mbed
00002 
00003 #include "mbed.h"
00004 #include "MMA7660.h"
00005 
00006 MMA7660 MMA(p28, p27);
00007 
00008 DigitalOut connectionLed(LED1);
00009 PwmOut Zaxis_p(LED2);
00010 PwmOut Zaxis_n(LED3);
00011 
00012 int main() {  
00013     if (MMA.testConnection())
00014         connectionLed = 1;
00015         
00016     while(1) {
00017         Zaxis_p = MMA.z();
00018         Zaxis_n = -MMA.z();
00019     }
00020 
00021 }