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
Badge
02 Lights
03 Control 6 Lights at a Time.c
1
/*
2
Control 6 Lights at a Time.c
3
Uses binary digits to control lights. This 0b101010 turns on lights
4
5, 3, and 1, and turns off 4, 2, and 0. Another way to think about it
5
is that it turns on the P17, P15, and P26 lights and turns off the P16,
6
P25 and P27 lights. Conversely, 0b010101turns on 4, 2, and 0 and turns
7
off 5, 3, and 1. That's P16, P25, P27 on, and P17, P15, and P26 off.
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
(
" BITS"
);
// Display text
17
screen_auto
(
OFF
);
// Auto-update off
18
while
(1)
// Main loop
19
{
20
cursor
(0, 1);
// Column 0, line 1
21
oledprint
(
"0b101010"
);
// Prep binary value
22
screen_update
();
// Copy to display
23
24
leds
(0b101010);
// Same value sets LEDs
25
pause(250);
// Wait 0.25 s
26
27
cursor
(0, 1);
// Reposition cursor
28
oledprint
(
"0b010101"
);
// Update binary value
29
screen_update
();
// ...and display
30
31
leds
(0b010101);
// Same value sets LEDs again
32
pause(250);
// ...for another 0.25 s
33
}
34
}
35
36
screen_update
int screen_update(void)
Manually update the screen image after. Typically used after multiple oLED function calls after scree...
Definition:
oled_asmfast.c:426
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
main
int main(void)
Definition:
GraphicsTest.c:20
leds
void leds(int bits)
Sets the on/off states of the 6 blue LEDs with a number that contains six binary 1/0 digits...
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
screen_auto
void screen_auto(int state)
Cause function calls like oledprint, point, and others to appear immediately after the function is ca...
Definition:
oled_auto.c:7
badgetools.h
This library provides convenient functions for a variety of Parallax eBadge operations.
cursor
void cursor(int col, int row)
Position the cursor to a certain column and row for printing text on the oLED display. Column can be 0 to 7 and row can be 0 or 1 in default LARGE text mode. In SMALL text mode, column can be 0 to 31, and row can be 0 to 7.
Definition:
oled_cursor.c:7
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:139
Generated on Sat Aug 27 2016 00:58:03 for PropWare by
1.8.12