PropWare
C++ objects and CMake build system for Parallax Propeller
Home
Download
Getting Started
Documentation
Reference
About
Related Links
Namespace List
Class List
File List
Examples
Build System
File List
File Members
propsideworkspace
Learn
Examples
Devices
Sensor
Accelerometer MX2125
Test 2125 Acceleration.c
1
/*
2
Test 2125 Acceleration.c
3
4
Measure X and Y-axis acceleration with Memsic 2125 accelerometer.
5
6
http://learn.parallax.com/propeller-c-simple-devices/tilt-and-acceleration-mx2125
7
*/
8
9
#include "simpletools.h"
// Include simpletools header
10
#include "mx2125.h"
// Include mx2125 header
11
12
int
main
()
// main function
13
{
14
while
(1)
// Repeat indefinitely
15
{
16
int
x = mx_accel(10);
// X-axis acceleration
17
int
y = mx_accel(11);
// Y-axis acceleration
18
print(
"%cx = %d, y = %d, %c\n"
,
// Display both
19
HOME, x, y, CLREOL);
20
pause(200);
// 1/5th second before repeat
21
}
22
}
23
main
int main(void)
Definition:
GraphicsTest.c:20
Generated on Sat Aug 27 2016 00:58:03 for PropWare by
1.8.12