PropWare
3.0.0.229
C++ objects and CMake build system for Parallax Propeller
Simple-Libraries
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
mx_accel
int mx_accel(int axisPin)
Measure acceleration in terms of g (acceleration due to earth's gravity). A measurement of +/-1250 co...
Definition:
mx2125.c:7
HOME
#define HOME
HOME character (1) sends SimpleIDE Terminal's cursor to top-left "home" position.
Definition:
simpletools.h:233
pause
void pause(int time)
Delay cog from moving on to the next statement for a certain length of time.
Definition:
libws2812.c:125
simpletools.h
This library provides convenient functions for a variety of microcontroller I/O, timing,...
print
int print(const char *format,...) __attribute__((format(printf
Print format "..." args to the default simple terminal device. The output is limited to 256 bytes.
main
int main(void)
Definition:
GraphicsTest.c:20
x
int x
Definition:
07 Box and Lines.c:13
CLREOL
#define CLREOL
CLREOL character (11) erases all SimpleIDE Terminal characters to the right of the cursor.
Definition:
simpletools.h:323
mx2125.h
Measure acceleration, tilt, and rotation with the Memsic MX2125 Dual-axis Accelerometer.
Generated on Fri May 20 2022 16:48:04 for PropWare by
1.8.17