PropWare
3.0.0.229
C++ objects and CMake build system for Parallax Propeller
Simple-Libraries
Learn
Examples
Badge
02 Lights
05 Both RGBs with 1 Call.c
1
/*
2
Both RGBs with 1 Call.c
3
Instead of picking between L and R, the rgbs function sets the left and
4
right colors with a single call. The RGB colors are actually constants
5
BLUE (1), GREEN (2), CYAN (3), RED (4), MAGENTA (5), YELLOW (6), WHITE(7).
6
So, a for... loop can also be used to index through each color.
7
*/
8
9
#include "
simpletools.h
"
// Include simpletools library
10
#include "
badgetools.h
"
// Include badgetools library
11
12
int
n = 0;
// Number
13
14
void
main
()
// Main function
15
{
16
badge_setup
();
// Call badge setup
17
oledprint
(
"One CallTwo RGBs"
);
18
19
rgbs
(
YELLOW
,
BLUE
);
// Left yellow, right blue
20
pause
(500);
21
rgbs
(
WHITE
,
GREEN
);
22
pause
(500);
23
24
while
(1)
// RGB color loop
25
{
26
for
(
int
n =
OFF
; n <
WHITE
*2; n++)
// Count through colors
27
{
28
rgbs
(n, 8-n);
// L counts up, R down
29
pause
(500);
// 1/2 s delay
30
}
31
}
32
}
33
34
GREEN
#define GREEN
For setting an RGB LED's color to green. Examples: rgb(R, GREEN) sets the right RGB LED to green....
Definition:
badgetools.h:112
WHITE
#define WHITE
For setting an RGB LED's color to white. Examples: rgb(L, WHITE) sets the left RGB LED white....
Definition:
badgetools.h:152
pause
void pause(int time)
Delay cog from moving on to the next statement for a certain length of time.
Definition:
libws2812.c:125
simpletools.h
This library provides convenient functions for a variety of microcontroller I/O, timing,...
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
badgetools.h
This library provides convenient functions for a variety of Parallax eBadge operations.
OFF
#define OFF
OFF can be used in place of zero to enabled parameters in functions like drive_feedback and drive_tri...
Definition:
abdrive.h:204
rgbs
void rgbs(int colorL, int colorR)
Set both RGB LED colors with one function call. See rgb function for color options.
YELLOW
#define YELLOW
For setting an RGB LED's color to yellow. Examples: rgb(L, YELLOW) sets the left RGB LED yellow....
Definition:
badgetools.h:144
BLUE
#define BLUE
For setting an RGB LED's color to blue. Examples: rgb(L, BLUE) sets the left RGB LED blue....
Definition:
badgetools.h:104
Generated on Fri May 20 2022 16:48:04 for PropWare by
1.8.17