User manual
82 l Robotics experiment with PIC microcontroller
Listing A10-1 : Reading data from ER-4 remote control program (final)
Lcd_Init(&PORTD); // Initialize LCD connected to PORTD
Lcd_Cmd(Lcd_CLEAR); // Clear display
Lcd_Cmd(Lcd_CURSOR_OFF); // Turn cursor off
Lcd_Out(1, 1, text);
// Print text to LCD,2nd row,1st column
Sound_Init(&PORTC,0);
while(1) // Infinite loop
{
key = get_remote(); // Get Remote
if(key=='a' || key=='A') // Button A press?
{
Lcd_Out(2, 1, "Button A Press "); // Display message Button A press
Sound_Play(100,500);
}
else if(key=='b' || key=='B') // Button B press?
{
Lcd_Out(2, 1, "Button B Press "); // Display message Button B press
Sound_Play(110,500);
}
else if(key=='c' || key=='C') // Button C press?
{
Lcd_Out(2, 1, "Button C Press "); // Display message Button C press
Sound_Play(120,500);
}
else if(key=='d' || key=='D') // Button D press?
{
Lcd_Out(2, 1, "Button D Press "); // Display message Button D press
Sound_Play(130,500);
}
}
}
A10.2 Put the 2 of AA batteries in the Batter holder of ER-4 Remote control.
A10.3 Turn-on power. Press the button switch on ER-4 Remote control to send data to ZX-
IRM at the Robo-PICA robot. Observe the operation at LCD module and piezo spekaer.
LCD will show letter A, B, C, D or a,b,c,d following press switch on ER-4 Remote
control and listen the diffrent beep sound frequency.