PropWare
3.0.0.229
C++ objects and CMake build system for Parallax Propeller
Simple-Libraries
Learn
Examples
Badge
04 Accelerometer
00 Check X Axis.c
1
/*
2
Check X Axis.c
3
Displays acceleration/tilt measured on the acceleromteer's X-axis.
4
Hold badge flat and tilt left/right to see the measurement change.
5
+/- 100 -> +/- 1 g
6
*/
7
8
#include "
simpletools.h
"
// Include simpletools library
9
#include "
badgetools.h
"
// Include badgetools library
10
11
int
x
;
// X-axis variable
12
13
void
main
()
// Main function
14
{
15
badge_setup
();
// Call badge setup
16
oledprint
(
"LR Tilt"
);
// Heading
17
while
(1)
// Main loop
18
{
19
x
=
accel
(
AX
);
// Get x acceleration/tilt
20
21
cursor
(0, 1);
// Display
22
oledprint
(
"x = %03d "
,
x
);
// Display tilt value
23
24
pause
(20);
// Wait 1/50 s
25
}
26
}
AX
#define AX
For choosing the accelerometer's x-axis. Example accel(AX) returns the component of the earth's gravi...
Definition:
badgetools.h:223
pause
void pause(int time)
Delay cog from moving on to the next statement for a certain length of time.
Definition:
libws2812.c:125
cursor
void cursor(int col, int row)
Position the cursor to a certain column and row for printing text on the oLED display....
Definition:
oled_cursor.c:7
simpletools.h
This library provides convenient functions for a variety of microcontroller I/O, timing,...
accel
int accel(int axis)
Measures acceleration and tilt on one of 3 axes (AX, AY, or AZ) in terms of centigravity (cg) units,...
Definition:
accelerometer.c:42
main
int main(void)
Definition:
GraphicsTest.c:20
oledprint
int oledprint(const char *fmt,...)
Use to display strings on the oLED display in a manner similar to displaying combinations of strings ...
Definition:
peb_text.c:4
badge_setup
int badge_setup(void)
Set up all available badge drivers. Call this function at the start of any given program to allow acc...
Definition:
badgealpha.c:29
x
int x
Definition:
07 Box and Lines.c:13
badgetools.h
This library provides convenient functions for a variety of Parallax eBadge operations.
Generated on Fri May 20 2022 16:48:04 for PropWare by
1.8.17