
RP6 ROBOT SYSTEM - 4. Programming the RP6
Example 15: Remote control by using a universal RC5 IR RC
Directory: <RP6Examples>\RP6BaseExamples\Example_08_TV_REMOTE\
File: RP6Base_TV_REMOTE.c
ATTENTION: The robot will move in this example program!
This example program enables you to control the robot just like a Remote Controlled
Car by using a standard RC5 IR remote control. Compared to standard functionality
for most RC-Cars, we added a few extra movements.
Of course, the vehicle can drive forwards and backwards, but is also able to rotate left
and right on the spot. Additionally the robot may drive in a curve forwards/backwards
to the left and right. It can even start a single motor in forwards or backwards direc-
tion.
In order to keep the program flexible, you can assign all these movement commands
to custom key codes matching your specific remote control. Movements are started
when a specific key code is received and the motor speed is accelerated slowly. When
you release the key, the motor speed is decelerated even slower. This means that the
robot accelerates and decelerates that slow intentionally (just in case you wonder
about that). It is also possible to immediately stop the robot within one or two centi-
metres (depending on load and speed) by pressing a special button.
RC5 reception may be used for various other functions – e.g. to start different pro-
grams, to set parameters in behaviours, to modify control parameters in speed con-
trol, etc...
With some universal remote controls it would be possible to control several robots by
using special function keys for selecting different devices – these function keys have
to be programmed to transmit RC5 signals and to address different devices – this en-
ables us to control several robots with one singule remote control.
Example 16: I²C Bus Interface – Master Mode
Directory: <RP6Examples>\RP6BaseExamples\Example_I2C_MASTER_01\
File: RP6Base_I2C_MASTER_01.c
This program demonstrates how to use the Master Mode of the I²C Bus. Of course
you will have to connect a suitable slave device to the I²C Bus before running
this program.
By using 8 LEDs, this example program implements a simple “Knight Rider”-running
light. The LEDs are connected to a standard 8-Bit I²C Bus Port expander PCF8574. You
may insert and solder the PCF8574 on the experiment expansion module (or initially
start a test by building the circuit on a breadboard). This already provides the system
with 8 free I/O-Ports for evaluating digital sensors or alternatively control small loads,
e.g. LEDs. Of course a big load requires external extra transistors or other driver
devices.
This chip is a very useful device and you may use a several of them on the same bus.
The only thing you have to do is to select an appropriate address for each chip with its
three address pins. If you want to use more than 8, you have to use 8 normal
PCF8574 and up to 8 more PCF8574A – which is using a different base address. This
allows you to address 8 of each type for controlling a total of 16*8 = 128 I/O Port Pins
through the I²C Bus!
- 120 -