PropWare
3.0.0.229
C++ objects and CMake build system for Parallax Propeller
Simple-Libraries
Learn
Examples
Badge
02 Lights
04 RBG LEDs.c
1
/*
2
RGB LEDs.c
3
Uses rgb(side, color) to control L or R leds, with color options of OFF,
4
BLUE, GREEN, CYAN, RED, MAGENTA, YELLOW, and WHITE.
5
*/
6
7
#include "
simpletools.h
"
// Include simpletools library
8
#include "
badgetools.h
"
// Include badgetools library
9
10
void
main
()
// Main function
11
{
12
badge_setup
();
// Call badge setup
13
oledprint
(
"RGB LEDs"
);
// Display text
14
oledprint
(
"L R"
);
// Sides
15
while
(1)
// Main loop
16
{
17
rgb
(
L
,
YELLOW
);
// Left, yellow
18
rgb
(
R
,
BLUE
);
// Right, blue
19
pause
(400);
// ...for 4/10 s
20
rgb
(
L
,
RED
);
// and so on...
21
rgb
(
R
,
WHITE
);
22
pause
(400);
23
rgb
(
L
,
WHITE
);
24
rgb
(
R
,
GREEN
);
25
pause
(400);
26
}
27
}
28
29
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
RED
#define RED
For setting an RGB LED's color to red. Examples: rgb(R, RED) sets the right RGB LED red....
Definition:
badgetools.h:128
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
R
#define R
For selecting the right of the two RGB LEDs. Example: rgb(R, GREEN) would set the right RGB LED to th...
Definition:
badgetools.h:96
rgb
void rgb(int side, int color)
Sets the color of the left or right RGB LED. Examples: rgb(L, RED) makes the left RGB LED glow red....
Definition:
leds_rgb.c:9
L
#define L
For selecting the left of the two RGB LEDs. Example: rgb(L, RED) would set the left RGB LED to the co...
Definition:
badgetools.h:88
badgetools.h
This library provides convenient functions for a variety of Parallax eBadge operations.
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