Hi all!
I am trying to make a project (for my son that loves photography) to rotate a camera a certain amount of degrees and triger it, the goal is to make 360 deg. photos.
To avoid a keyboard I am trying to use a IRremote command to interface with the machine.
Now, my problem is the following:
I am using the IRremote library and try to use " (irrecv.decode(&results))" as function, because, I need also to work with the display and stepping motor, but I get a few errors. Can I use this as a function or I must include the remaining code after close the ' if ' bracket ' } '. The code is below:
Thanks in adbance for your help.
Manuel
#include <DogLcd.h>
// initialize the library with the numbers of the interface pins
DogLcd lcd(9, 10, 11, 12);
#include <IRremote.h>
int receiver = 8; // Conectar IR Receiver na porta digital 8
IRrecv irrecv(receiver); // Criar objeto 'irrecv'
decode_results results;
void setup()
{
lcd.begin(DOG_LCD_M163,0x28);
lcd.clear();
delay(100);
// Serial.begin(9600); // for serial monitor output
irrecv.enableIRIn(); // Start the receiver
}
void loop()
{
for(;;)
{
IR_code();
}
IR_code()
{
if (irrecv.decode(&results)) // have we received an IR signal?
{
//lcd.print(results.value, DEC); // Imprimir na porta serial o valor do controle
switch(results.value)
{
case 59: lcd.print(" Menu "); break;
case 2107: lcd.print(" Menu "); break;
case 32: lcd.print(" up "); break;
case 2080: lcd.print(" up "); break;
case 33: lcd.print(" down "); break;
case 2081: lcd.print(" down "); break;
case 16: lcd.print(" right "); break;
case 2064: lcd.print(" right "); break;
case 17: lcd.print(" left "); break;
case 2065: lcd.print("left "); break;
case 37: lcd.print(" OK/Enter "); break;
case 2085: lcd.print("OK/Enter "); break;
case 55: lcd.print(" Exit "); break;
case 2103: lcd.print(" Exit "); break;
case 2049: lcd.print(" 1 "); break;
case 1: lcd.print(" 1 "); break;
case 2: lcd.print(" 2 "); break;
case 2050: lcd.print(" 2 "); break;
case 3: lcd.print(" 3 "); break;
case 2051: lcd.print(" 3 "); break;
case 4: lcd.print(" 4 "); break;
case 2052: lcd.print(" 4 "); break;
case 5: lcd.print(" 5 "); break;
case 2053: lcd.print(" 5 "); break;
case 6: lcd.print(" 6 "); break;
case 2054: lcd.print(" 6 "); break;
case 7: lcd.print(" 7 "); break;
case 2055: lcd.print(" 7 "); break;
case 8: lcd.print(" 8 "); break;
case 2056: lcd.print(" 8 "); break;
case 9: lcd.print(" 9 "); break;
case 2057: lcd.print(" 9 "); break;
case 0: lcd.print(" zero "); break;
case 2048: lcd.print(" zero "); break;
default: lcd.print(" other button ");
}
delay(500);
irrecv.resume(); // receive the next value
} // Your loop can do other things while waiting for an IR command
}
}
The error codes it gives are the following:
.cpp: In function 'void loop()':
:64: error: 'IR_code' was not declared in this scope
:65: error: 'IR_code' was not declared in this scope
:70: error: expected ';' before '{' token
:118 error: expected '}' at the end of input