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
06 Infrared Data
01 Receive Strings with IR.c
1
/*
2
Receive Strings with IR.c
3
For receiving IR strings, use the receive function. 128 is your
4
maxiumum buffer size.
5
*/
6
7
#include "simpletools.h"
// Include simpletools library
8
#include "
badgetools.h
"
// Include badgetools library
9
10
char
irbuf[128];
// Receive buffer
11
int
irlen, states;
// Incoming length, button states
12
13
void
main
()
// Main function
14
{
15
badge_setup
();
// Call badge setup
16
while
(1)
// Main loop
17
{
18
clear
();
19
text_size
(
LARGE
);
20
oledprint
(
" IR Rcv "
);
21
while
(1)
22
{
23
irlen =
receive
(irbuf);
// Check incoming IR
24
if
(irlen > 0)
// Yes? exit while loop
25
{
26
break
;
27
}
28
}
29
clear
();
// Display incoming message
30
text_size
(
SMALL
);
31
oledprint
(irbuf);
32
cursor
(0, 6);
// Press button to repeat
33
oledprint
(
"Again? Any btn."
);
34
while
(!
buttons
());
35
}
36
}
buttons
int buttons(void)
Gets the states of all seven touch buttons, and returns them in a value with 1s and 0s that correspon...
Definition:
jm_touchpads.c:90
text_size
void text_size(int size)
Set the text size to either 32x16 pixel (LARGE) or 7x5 (SMALL) characters. Examples: text_size(LARGE)...
Definition:
oled_text_size.c:7
SMALL
#define SMALL
For setting oLED character size to 7x5 pixels. Example: text_size(SMALL).
Definition:
badgetools.h:200
clear
int clear(void)
Clear the display.
Definition:
oled_clear.c:7
LARGE
#define LARGE
For setting oLED character size to 32x16 pixels. Example: text_size(LARGE).
Definition:
badgetools.h:192
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
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.
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
receive
int receive(char *s)
Receive a character string from another badge.
Definition:
peb_ir_receive.c:6
Generated on Sat Aug 27 2016 00:58:03 for PropWare by
1.8.12