PropWare
3.0.0.229
C++ objects and CMake build system for Parallax Propeller
Simple-Libraries
Learn
Examples
Badge
02 Lights
00 Blink Light.c
1
/*
2
Blink Light.c
3
6 LED lights can be controlled with led(number, state). The number can
4
be 0 to 5, and the state is ON or OFF. The light numbers start at the
5
top-right with 0, and increase clockwise, to 5 at the top-left. So,
6
{0, 1, 2, 3, 4, 5} corresponds to lights labeled {P27, P26, P25, P15,
7
P16, P17}.
8
*/
9
10
#include "
simpletools.h
"
// Include simpletools library
11
#include "
badgetools.h
"
// Include badgetools library
12
13
void
main
()
// Main function
14
{
15
badge_setup
();
// Call badge setup
16
oledprint
(
" BLINK\n P27"
);
// Display
17
while
(1)
// Main loop
18
{
19
led
(0,
ON
);
// P27 light on
20
pause
(100);
// For 0.1 s
21
led
(0,
OFF
);
// P27 light off
22
pause
(100);
// For 0.1 s
23
}
24
}
25
26
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,...
led
void led(int n, int state)
Set a blue LED (from 0 to 5) to a state (ON or OFF). Examples: led(1, ON) turns the blue LED next to ...
Definition:
leds_led.c:9
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
ON
#define ON
ON can be used in place of a nonzero value to enabled parameters in functions like drive_feedback and...
Definition:
abdrive.h:212
Generated on Fri May 20 2022 16:48:04 for PropWare by
1.8.17