PropWare
3.0.0.229
C++ objects and CMake build system for Parallax Propeller
Simple-Libraries
Learn
Simple Libraries
Sensor
libcolorpal
libcolorpal.c
1
/*
2
libcolorpal.c
3
colorpal library test harness.
4
ColorPAL SIO pin connected to Propeller P6.
5
*/
6
7
8
#include "
simpletools.h
"
9
#include "
colorpal.h
"
10
11
int
cpSIO = 6;
12
int
r, g, b;
13
colorPal *cpal;
14
15
int
main
()
16
{
17
cpal =
colorPal_open
(cpSIO);
18
while
(1)
19
{
20
colorPal_getRGB
(cpal, &r, &g, &b);
21
print
(
"r = %03x g = %03x b = %03x\n"
,
22
r, g, b);
23
pause
(1000);
24
}
25
}
26
27
colorPal_getRGB
void colorPal_getRGB(colorPal *device, int *r, int *g, int *b)
Get RGB (red green blue) values from the ColorPAL sensor.
Definition:
colorpal.c:47
pause
void pause(int time)
Delay cog from moving on to the next statement for a certain length of time.
Definition:
libws2812.c:125
colorpal.h
Simplifies reading Parallax ColorPAL sensor.
simpletools.h
This library provides convenient functions for a variety of microcontroller I/O, timing,...
print
int print(const char *format,...) __attribute__((format(printf
Print format "..." args to the default simple terminal device. The output is limited to 256 bytes.
main
int main(void)
Definition:
GraphicsTest.c:20
colorPal_open
colorPal * colorPal_open(int sioPin)
Open a connection to a Parallax ColorPAL sensor.
Definition:
colorpal.c:79
Generated on Fri May 20 2022 16:48:05 for PropWare by
1.8.17