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
Joystick
joystick_adc.c
1
/*
2
Joystick.c
3
4
Simple Propeller P8X32A Propeller C demo with the Parallax 2-axis Joystick
5
6
http://learn.parallax.com/propeller-c-simple-devices/joystick
7
*/
8
9
#include "adcDCpropab.h"
// Include adcDCpropab
10
#include "simpletools.h"
// Include simpletools
11
12
13
int
main
()
// Main function
14
{
15
pause(1000);
// Wait 1 s for Terminal app
16
adc_init(21, 20, 19, 18);
// CS=21, SCL=20, DO=19, DI=18
17
18
float
lrV, udV;
// Voltage variables
19
20
while
(1)
// Loop repeats indefinitely
21
{
22
udV = adc_volts(2);
// Check A/D 2
23
lrV = adc_volts(3);
// Check A/D 3
24
25
putChar(HOME);
// Cursor -> top-left "home"
26
print(
"Up/Down = %.2f V %c\n"
, udV, CLREOL);
// Display voltage
27
print(
"Left/Right = %.2f V %c\n"
, lrV, CLREOL);
// Display voltage
28
29
pause(100);
// Wait 1/10 s
30
}
31
}
32
main
int main(void)
Definition:
GraphicsTest.c:20
Generated on Sat Aug 27 2016 00:58:03 for PropWare by
1.8.12