![]() |
embedded system library for e-puck
1.0.1
A redesigned API library for the e-puck robot platform
|
interface of the IR receiver on top of the e-puck More...
Files | |
file | el_ir_receiver.h |
interface of the IR receiver on top of the e-puck
The e-puck has a IR receiver module — TSOP36236. It is able to receive transmissions based on RC5 protocol which is a protocol used by domestic appliances (e.g. a TV remote). For example, Philip and Toshiba are known to use the protocol.
To utilize a TV remote to command one or a group of e-pucks, the first thing to do it to study what exactly the data received are. In this example, any valid transmission is received and the data obtained are displayed via serial communication.
Note: the code to enable the ir receiver (el_enable_ir_receiver) and launching of the process is not shown in the code section above.
In Display the Data Received, the IR receiver is used in an infinite loop within a process. A disadvantage of doing so is that it constantly occupies a process. The maximum number of processes is limited, which may run out if all components occupy a process of their own. Using a trigger to handle the IR receiver is a better design choice.
In this example, a trigger is written to make a LED on the robot controlled by a key on the remote.
Related global variables and function prototypes:
Code to setup/clear the trigger:
Code of the trigger's condition callback and process:
For the above trigger, it is also valid to move the code in the process function to the condition function because the program does not require any timing (e.g. el_process_wait). If that's the case, a process is no longer required and no el_trigger_enable is needed at the end.
The address and key values from the universal remote (emulating a Philip VCR remote) used in Sheffield Robotics: