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
ColorPAL
Test ColorPAL.c
1
/*
2
Test ColorPAL.c
3
4
Test Parallax ColorPAL sensor.
5
6
Connect: sig to P6, +5V to 5V, Gnd to GND
7
8
http://www.parallax.com/product/28380
9
*/
10
11
#include "simpletools.h"
// Include simpletools
12
#include "colorpal.h"
// Include colorpal
13
14
colorPal
*cpal;
// Device identifier
15
int
cpSIO = 6;
// ColorPAL SIO -> Propeller P6
16
int
r, g, b;
// Variables for red, green, blue
17
18
int
main
()
// Main function
19
{
20
cpal = colorPal_open(cpSIO);
// Open connection to ColorPAL
21
22
while
(1)
// Main loop
23
{
24
colorPal_getRGB(cpal, &r, &g, &b);
// Get red/green/blue readings
25
26
print(
"r = %04d g = %04d b = %04d\n"
,
// Display red/green/blue readings
27
r, g, b);
28
29
pause(1000);
// 1 s before repeat
30
}
31
}
main
int main(void)
Definition:
GraphicsTest.c:20
text_struct
Structure that contains data used by simple text device libraries.
Definition:
simpletext.h:70
Generated on Sat Aug 27 2016 00:58:03 for PropWare by
1.8.12