PropWare
3.0.0.229
C++ objects and CMake build system for Parallax Propeller
Simple-Libraries
Learn
Examples
Devices
TV Remote
Test SIRC Remote.c
1
/*
2
Test SIRC Remote.c
3
4
http://learn.parallax.com/propeller-c-simple-devices/ir-receiver-and-remote
5
6
Connect 38 kHz IR receiver to Propeller P10
7
Decodes button presses on Sony-compatible IR remote
8
Run with Terminal
9
*/
10
11
#include "
simpletools.h
"
// Libraries included
12
#include "
sirc.h
"
13
14
int
main
()
// main function
15
{
16
sirc_setTimeout
(1000);
// -1 if no remote code in 1 s
17
18
while
(1)
// Repeat indefinitely
19
{
20
// decoding signal from P10
21
print
(
"%c remote button = %d%c"
,
// Display button # decoded
22
HOME
,
sirc_button
(10),
CLREOL
);
// from signal on P10
23
24
pause
(100);
// 1/10 s before loop repeat
25
}
26
}
27
28
sirc_button
int sirc_button(int pin)
Report the SONY IR remote button pressed. Removes device identifying information from the packet and ...
Definition:
sirc.c:15
sirc.h
Decode SONY IR remote signals.
HOME
#define HOME
HOME character (1) sends SimpleIDE Terminal's cursor to top-left "home" position.
Definition:
simpletools.h:233
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,...
print
int print(const char *format,...) __attribute__((format(printf
Print format "..." args to the default simple terminal device. The output is limited to 256 bytes.
main
int main(void)
Definition:
GraphicsTest.c:20
CLREOL
#define CLREOL
CLREOL character (11) erases all SimpleIDE Terminal characters to the right of the cursor.
Definition:
simpletools.h:323
sirc_setTimeout
void sirc_setTimeout(int ms)
Set the time limit to wait for a SONY IR remote packet.
Definition:
sirc.c:10
Generated on Fri May 20 2022 16:48:04 for PropWare by
1.8.17