Simon Ford
/
LIS302_HelloWorld
Hello World for the LIS302 accelerometer library
Revision 1:768e44d2e442, committed 2010-09-02
- Comitter:
- simon
- Date:
- Thu Sep 02 17:59:57 2010 +0000
- Parent:
- 0:676c81a790ac
- Commit message:
- Add tags, comments, and publish using LIS302 library
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
diff -r 676c81a790ac -r 768e44d2e442 main.cpp --- a/main.cpp Tue Jun 08 13:36:14 2010 +0000 +++ b/main.cpp Thu Sep 02 17:59:57 2010 +0000 @@ -1,13 +1,14 @@ -// LIS302 Hello World! - -#include "mbed.h" -#include "LIS302.h" - -LIS302 acc(p5, p6, p7, p8); // mosi, miso, sclk, ncs - -int main() { - while(1) { - printf("%.3f %.3f %.3f\n", acc.x(), acc.y(), acc.z()); - wait(0.1); - } -} +// LIS302 Hello World! moves leds based on x acceleration + +#include "mbed.h" +#include "LIS302.h" + +LIS302 acc(p5, p6, p7, p8); // mosi, miso, sclk, ncs +BusOut leds(LED1, LED2, LED3, LED4); + +int main() { + while(1) { + leds = 1 << (int)(4 * acc.x()); + wait(0.1); + } +}
diff -r 676c81a790ac -r 768e44d2e442 mbed.bld --- a/mbed.bld Tue Jun 08 13:36:14 2010 +0000 +++ b/mbed.bld Thu Sep 02 17:59:57 2010 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/mbed/builds/029aa53d7323 +http://mbed.org/users/mbed_official/code/mbed/builds/74b8d43b5817