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
Circuits
Measure Volts.c
1
/*
2
Measure Volts.c
3
4
Make voltmeter style measurements with the Propeller Activity Board.
5
6
http://learn.parallax.com/propeller-c-simple-circuits/measure-volts
7
*/
8
9
#include "simpletools.h"
// Include simpletools
10
#include "adcDCpropab.h"
// Include adcDCpropab
11
12
int
main
()
// Main function
13
{
14
adc_init(21, 20, 19, 18);
// CS=21, SCL=20, DO=19, DI=18
15
16
float
v2, v3;
// Voltage variables
17
18
while
(1)
// Loop repeats indefinitely
19
{
20
v2 = adc_volts(2);
// Check A/D 2
21
v3 = adc_volts(3);
// Check A/D 3
22
23
putChar(HOME);
// Cursor -> top-left "home"
24
print(
"A/D2 = %f V%c\n"
, v2, CLREOL);
// Display volts
25
print(
"A/D3 = %f V%c\n"
, v3, CLREOL);
// Display volts
26
27
pause(100);
// Wait 1/10 s
28
}
29
}
main
int main(void)
Definition:
GraphicsTest.c:20
Generated on Sat Aug 27 2016 00:58:03 for PropWare by
1.8.12