Chris Styles
/
LIS302
Example using LIS302 accelerometer printing values over USB serial
main.cpp@0:9caf9cb82de0, 2010-02-21 (annotated)
- Committer:
- chris
- Date:
- Sun Feb 21 11:43:09 2010 +0000
- Revision:
- 0:9caf9cb82de0
- Child:
- 1:05bd934b3abd
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
chris | 0:9caf9cb82de0 | 1 | #include "mbed.h" |
chris | 0:9caf9cb82de0 | 2 | #include "LIS302.h" |
chris | 0:9caf9cb82de0 | 3 | |
chris | 0:9caf9cb82de0 | 4 | LIS302 acc(p11, p12, p13, p10); // mosi, miso, clk, ncs |
chris | 0:9caf9cb82de0 | 5 | |
chris | 0:9caf9cb82de0 | 6 | int main() { |
chris | 0:9caf9cb82de0 | 7 | |
chris | 0:9caf9cb82de0 | 8 | for (int i = 0; i < 100; i++) { |
chris | 0:9caf9cb82de0 | 9 | printf("%.2f, %.2f, %.2f\n", acc.x(),acc.y(),acc.z()); |
chris | 0:9caf9cb82de0 | 10 | wait(0.1); |
chris | 0:9caf9cb82de0 | 11 | } |
chris | 0:9caf9cb82de0 | 12 | } |