Module ctr.ir
The ir module.
Usage:
local ir = require("ctr.ir")
bitrates |
Bitrate codes list (this is not a part of the module, just a reference) |
-
init ([bitrate=6])
-
Initialize the IR module.
Parameters:
- bitrate
number
bitrate of the IR module (more informations below)
(default 6)
Returns:
boolean
true
if everything went fine
Or
-
boolean
false
in case of error
-
integer
error code
-
shutdown ()
-
Disable the IR module.
Returns:
boolean
true
if everything went fine
Or
-
boolean
false
in case of error
-
integer
error code
-
send (data[, wait=false])
-
Send some data over the IR module.
Parameters:
- data
string
just some data
- wait
boolean
set to
true
to wait until the data is sent.
(default false)
Returns:
boolean
true
if everything went fine
Or
-
boolean
false
in case of error
-
integer
error code
-
receive (size[, wait=false])
-
Receive some data from the IR module.
Parameters:
- size
number
bytes to receive
- wait
boolean
wait until the data is received
(default false)
Returns:
string
data
Or
-
nil
in case of error
-
integer
error code
-
setBitRate (bitrate)
-
Set the bitrate of the communication.
Parameters:
- bitrate
number
new bitrate for the communication
Returns:
boolean
true
if everything went fine
Or
-
boolean
false
in case of error
-
integer
error code
-
getBitRate ()
-
Return the actual bitrate of the communication.
Returns:
number
actual bitrate
Or
-
nil
in case of error
-
integer
error code
-
bitrates
-
Bitrate codes list (this is not a part of the module, just a reference)
Fields:
- 3
115200
- 4
96000
- 5
72000
- 6
48000 (default)
- 7
36000
- 8
24000
- 9
18000
- 10
12000
- 11
9600
- 12
6000
- 13
3000
- 14
57600
- 15
38400
- 16
19200
- 17
7200
- 18
4800