Hello World for the LIS302 accelerometer library

Dependencies:   mbed LIS302

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 // LIS302 Hello World! moves leds based on x acceleration
00002 
00003 #include "mbed.h"
00004 #include "LIS302.h"
00005 
00006 LIS302 acc(p5, p6, p7, p8); // mosi, miso, sclk, ncs
00007 BusOut leds(LED1, LED2, LED3, LED4);
00008 
00009 int main() {
00010     while(1) {
00011         leds = 1 << (int)(4 * acc.x());
00012         wait(0.1);
00013     }
00014 }