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
simple
mx2125_tilt.c
1
5
#include "mx2125.h"
6
7
int
mx_tilt(
int
axisPin)
8
{
9
int
a = mx_accel(axisPin);
10
float
fa = (float) a;
11
if
(fa > 1250.0) fa = 1250.0;
12
if
(fa < -1250.0) fa = -1250.0;
13
float
angle = asin(fa/1250.0) * 180.0 / PI;
14
int
tilt = (int) angle;
15
return
(
int
) tilt;
16
}
Generated on Sat Aug 27 2016 00:58:09 for PropWare by
1.8.12