Infrared | lrf.infrared
Little Robot Friends have an infrared transceiver, which enable the robots to send and receive small pieces of information to and from each other. The infrared communication is intended for short distances, generally no more than 2 inches.
Functions called from within the "infrared" portion of the library have the prefix of lrf.infrared
enable()
Description
This function enables the Infrared transceiver, which allows for local communication between robots.
Examples
lrf.infrared.enable();
Syntax
enable()
Parameters
none
Returns
none
Notes
none
disable()
Description
This function disables the Infrared transceiver, which allows for local communication between robots.
Examples
lrf.infrared.disable();
Syntax
disable()
Parameters
none
Returns
none
Notes
none
writeMessage()
Description
Examples
lrf.infrared.writeMessage(*myMsg);
Syntax
writeMessage(*msg)
Parameters
msg
: LRFMessage* type - A pointer to the message that the user wants to send.
Returns
none
Notes
This function makes use of the pointer symbol. *
writeBytes()
Description
Examples
lrf.infrared.writeBytes(*myBytes,bytesLength);
Syntax
writeBytes(*bytes, length)
Parameters
bytes
: unsigned char* - A pointer to the bytes that the user wants to send.length
: unsigned char - number of bytes
Returns
none
Notes
This function makes use of the pointer symbol. *
writeByte()
Description
Examples
lrf.infrared.writeByte(myByte);
Syntax
writeByte(byte)
Parameters
byte
: unsigned char - The byte of information that the user wants to send.
Returns
none
Notes
This function makes use of the pointer symbol. *
readMessage()
Description
Examples
lrf.infrared.readMessage(*myMsg);
Syntax
readMessage(*msg)
readMessage(*msg, timeout)
Parameters
byte
: unsigned char* - A pointer to the message that the user wants to read.timeout
(optional) : unsigned int - amount of time allowed before timeout occurs. Default value is 1000ms.
Returns
none
Notes
This function makes use of the pointer symbol. *
readBytes()
Description
Examples
lrf.infrared.readBytes(*myBytes, bytesLength);
Syntax
readBytes(*bytes, length)
readBytes(*bytes, length, timeout)
Parameters
byte
: unsigned char* - A pointer to the bytes that the user wants to read.length
: unsigned char - length of bytestimeout
(optional) : unsigned int - amount of time allowed before timeout occurs. Default value is 1000ms.
Returns
none
Notes
This function makes use of the pointer symbol. *
readBytes()
Description
Examples
lrf.infrared.readByte(*myByte);
Syntax
readByte(*byte)
readByte(*byte, timeout)
Parameters
byte
: unsigned char* - A pointer to the byte that the user wants to read.timeout
(optional) : unsigned int - amount of time allowed before timeout occurs. Default value is 1000ms.
Returns
none
Notes
This function makes use of the pointer symbol. *