loading

HELP! What is wrong with my Arduino Coding?!?

I am attempting to use Arduino for the very first time. I have a small projector that I am trying to get the Arduino to automatically power up, and go through the menu settings (without human intervention).  I found the below coding online, and assuming it would be an easy copy paste..I bought all the supplies....yet...now when I try to use the Code- I keep getting errors. Help!! I know absolutly nothing about coding, or electronic programming...and I am stuck on this project for work!

I keep getting errors about "ISO C++ forbids declaration of 'storecode' with no type at 54.

What does this mean? THANK YOU SOOO MUCH FOR READING/TRYING.


----------------------------------------------------------------------------------------

/*
* Beamer control (with LG LED beamer)
* IRrecord: record and play back IR signals as a minimal
*
* IR LED connected to PIN 3 (AtmelATmega88 pin 5
*/

#include <IRremote.h>

int RECV_PIN = 11;
int BUTTON_PIN = 12;
int STATUS_PIN = 13;

IRrecv irrecv(RECV_PIN);
IRsend irsend;

decode_results results;

#define on 0x20DFB54A
#define usb 0x20DF3EC1
#define ok 0x20DF22DD
#define down 0x20DF827D
#define left 0x20DF609F

typedef struct {
long time;
long code;
} remoteAction;

remoteAction beamerShow[17]={
{5,on},{20,usb},{23,ok},{24,ok},{25,down},
{26,ok},{27,down},{28,ok},{29,ok},{30,ok},
{31,down},{32,ok},{33,left},{34,left},{35,left},
{26,ok},{1000,on}};

int pointer=0;
void setup()
{
Serial.begin(9600);
irrecv.enableIRIn(); // Start the receiver
pinMode(BUTTON_PIN, INPUT);
pinMode(STATUS_PIN, OUTPUT);

}

// Storage for the recorded code
int codeType = -1; // The type of code
unsigned long codeValue; // The code value if not raw
unsigned int rawCodes[RAWBUF]; // The durations if raw
int codeLen; // The length of the code
int toggle = 0; // The RC5/6 toggle state

// Stores the code for later playback
// Most of this code is just logging
void storeCode(decode_results *results) {
codeType = results->decode_type;
int count = results->rawlen;
if (codeType == UNKNOWN) {
Serial.println("Received unknown code, saving as raw");
codeLen = results->rawlen - 1;
// To store raw codes:
// Drop first value (gap)
// Convert from ticks to microseconds
// Tweak marks shorter, and spaces longer to cancel out IR receiver distortion
for (int i = 1; i <= codeLen; i++) {
if (i % 2) {
// Mark
rawCodes[i - 1] = results->rawbuf[i]*USECPERTICK - MARK_EXCESS;
Serial.print(" m");
}
else {
// Space
rawCodes[i - 1] = results->rawbuf[i]*USECPERTICK + MARK_EXCESS;
Serial.print(" s");
}
Serial.print(rawCodes[i - 1], DEC);
}
Serial.println("");
}
else {
if (codeType == NEC) {
Serial.print("Received NEC: ");
if (results->value == REPEAT) {
// Don't record a NEC repeat value as that's useless.
Serial.println("repeat; ignoring.");
return;
}
}
else if (codeType == SONY) {
Serial.print("Received SONY: ");
}
else if (codeType == RC5) {
Serial.print("Received RC5: ");
}
else if (codeType == RC6) {
Serial.print("Received RC6: ");
}
else {
Serial.print("Unexpected codeType ");
Serial.print(codeType, DEC);
Serial.println("");
}
Serial.println(results->value, HEX);
codeValue = results->value;
codeLen = results->bits;
}
}

void sendCode(int repeat) {
if (codeType == NEC) {
if (repeat) {
irsend.sendNEC(REPEAT, codeLen);
Serial.println("Sent NEC repeat");
}
else {
irsend.sendNEC(codeValue, codeLen);
Serial.print("Sent NEC ");
Serial.println(codeValue, HEX);
}
}
else if (codeType == SONY) {
irsend.sendSony(codeValue, codeLen);
Serial.print("Sent Sony ");
Serial.println(codeValue, HEX);
}
else if (codeType == RC5 || codeType == RC6) {
if (!repeat) {
// Flip the toggle bit for a new button press
toggle = 1 - toggle;
}
// Put the toggle bit into the code to send
codeValue = codeValue & ~(1 << (codeLen - 1));
codeValue = codeValue | (toggle << (codeLen - 1));
if (codeType == RC5) {
Serial.print("Sent RC5 ");
Serial.println(codeValue, HEX);
irsend.sendRC5(codeValue, codeLen);
}
else {
irsend.sendRC6(codeValue, codeLen);
Serial.print("Sent RC6 ");
Serial.println(codeValue, HEX);
}
}
else if (codeType == UNKNOWN /* i.e. raw */) {
// Assume 38 KHz
irsend.sendRaw(rawCodes, codeLen, 38);
Serial.println("Sent raw");
}
}

int lastButtonState;

void loop() {

long timer=millis()/1000;

if (timer>beamerShow[pointer].time)
{
digitalWrite(STATUS_PIN, HIGH);
irsend.sendNEC(beamerShow[pointer].code, 32); //on/off
digitalWrite(STATUS_PIN, LOW);
pointer++;
}
}

ilyal5 years ago
arcfn.com/2009/08/multi-protocol-infrared-remote-library.html

Is this the library you are trying to use ?
The error you are getting is usually related to template classes such as found in standard template library, which need specific type to instantiate. However I dont see any use of such classes.
I also dont see where you are calling storeCode function from anywhere.
If it isn't called there is no use to include it in your code.
Please provide some more info on what you are trying to do with your code.
Cutting and pasting code you don't understand nearly always ends in tears if the code doesn't work first time.

Where is the code taken from ? Was it definitely for an Arduino to begin with ?

Steve