HELP SO MANNY ERRORS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

HI im new to arduinos. i have a arduino uno and i do not know how to program and i follow turturials.
i enter the code below and it has so manny errors. i was wandering if someone could tell me how to fix them.

HELP!!! :grin: :smiley: :. :frowning: :sleeping: ]:smiley: :stuck_out_tongue_closed_eyes: ]:slight_smile: :roll_eyes: :zipper_mouth_face: :% 8) :cold_sweat: :0 :slight_smile:
(5-7 errors)

# Include <IRremote.h>

int RECV_PIN = 11;

int LED1 = 2;

int LED2 = 3;

int LED3 = 4;

int LED4 = 5;

int LED5 = 6;

int LED6 = 7;

long on1 = 0x00FFA25D;

long off1 = 0x00FFE01F;

long on2 = 0x00FF629D;

long off2 = 0x00FFA857;

long on3 = 0x00FFE21D;

long off3 = 0x00FF906F;

long on4 = 0x00FF22DD;

long off4 = 0x00FF6897;

long on5 = 0x00FF02FD;

long off5 = 0x00FF9867;

long on6 = 0x00FFC23D;

long off6 = 0x00FFB047;

IRrecv irrecv (RECV_PIN);

decode_results results;

/ / Dumps out the decode_results structure.

/ / Call this after IRrecv :: decode ()

/ / Void * to work around compiler issue

/ / Void dump (void * v) {

/ / Decode_results * results = (decode_results *) v

void dump (decode_results * results) {

int count = results-> rawlen;

if (results-> decode_type == UNKNOWN)

{

Serial.println ("Could not decode message");

}

else

{

if (results-> decode_type == NEC)

{

Serial.print ("Decoded NEC:");

}

else if (results-> decode_type == SONY)

{

Serial.print ("Decoded SONY:");

}

else if (results-> decode_type == RC5)

{

Serial.print ("Decoded RC5:");

}

else if (results-> decode_type == RC6)

{

Serial.print ("Decoded RC6:");

}

Serial.print (results-> value, HEX);

Serial.print ("(");

Serial.print (results-> bits, DEC);

Serial.println ("bits)");

}

Serial.print ("Raw (");

Serial.print (count, DEC);

Serial.print ("):");

 

for (int i = 0; i <count; i + +)

{

if ((i% 2) == 1) {

Serial.print (results-> rawbuf [i] * USECPERTICK, DEC);

}

else

{

Serial.print (- (int) results-> rawbuf [i] * USECPERTICK, DEC);

}

Serial.print ("");

}

Serial.println ("");

}

 

void setup ()

{

pinMode (RECV_PIN, INPUT);

pinMode (LED1, OUTPUT);

pinMode (LED2, OUTPUT);

pinMode (LED3, OUTPUT);

pinMode (LED4, OUTPUT);

pinMode (LED5, OUTPUT);

pinMode (LED6, OUTPUT);

pinMode (13, OUTPUT);

Serial.begin (9600);

 

irrecv.enableIRIn (); / / Start the receiver

}

 

int on = 0;

unsigned long last = millis ();

 

void loop ()

{

if (irrecv.decode (& results))

{

/ / If it's been at least 1/4 second since the last

/ / IR received, toggle the relay

if (millis () - last> 250)

{

on =! on;

/ / DigitalWrite (8, on? HIGH: LOW);

digitalWrite (13, on? HIGH: LOW);

dump (& results);

}

if (results.value == on1)

digitalWrite (LED1, HIGH);

if (results.value == off1)

digitalWrite (LED1, LOW);

if (results.value == on2)

digitalWrite (LED2, HIGH);

if (results.value == off2)

digitalWrite (LED2, LOW);

if (results.value == on3)

digitalWrite (LED3, HIGH);

if (results.value == off3)

digitalWrite (LED3, LOW);

if (results.value == on4)

digitalWrite (LED4, HIGH);

if (results.value == off4)

digitalWrite (LED4, LOW);

if (results.value == on5)

digitalWrite (LED5, HIGH);

if (results.value == off5)

digitalWrite (LED5, LOW);

if (results.value == on6)

digitalWrite (LED6, HIGH);

if (results.value == off6)

digital Write (LED6, LOW);

last = millis ();

irrecv.resume (); / / Receive the next value

}

}

i really need help!!!

What errors?

For a start, comments are:

//

Not:

/ /

Lose the space between the slashes.

If this is truly what your code looks like in your compiler then I can tell you just a few errors.

  1. all those variables labeled “long” should be “long something” I don’t know about hex so you’ll have to figure it out by yourself.

  2. where you have put comments (or what is suppose to be a comment) you’ve got / / (two “/” with a space between them) it should just be // (two “/” with no space between them)

  3. you can’t declare a function before setup() (at least that’s what I’ve found to be true) so you’ll need to move all that stuff down to the bottom

4)there’s a bit of random variable deceleration between setup() and loop() so you’ll need to move that, it can’t go there. the program will never pick it up because the main() execution looks like this:

#include <Arduino.h>

int main(void)
{
	init();

#if defined(USBCON)
	USBDevice.attach();
#endif
	
	setup();
    
	for (;;) {
		loop();
		if (serialEventRun) serialEventRun();
	}
        
	return 0;
}

But beyond that it seams your good to go, I can’t tell you for certain though so try it out and see what happens. Oh and also you might want to format you code so it looks neater, it was difficult to read with it all spaced out. take a look inside some already done programs and follow their formatting it will make your life easier.

ask if you need more help.

well

i can email the manual(translated from Chinese i not tho)

the code uses ir remotes to turn on leds by pressing buttens i got my kit 1 week ago.

i new to arduino as i said so i may sound a little dumb but i don't know ANY code. So sorry but i dont help the errors i have are below

sketch_jul27a:3: error: variable or field 'dump' declared void
sketch_jul27a:3: error: 'decode_results' was not declared in this scope
sketch_jul27a:3: error: 'results' was not declared in this scope
sketch_jul27a:21: error: 'IRrecv' does not name a type
sketch_jul27a:22: error: 'decode_results' does not name a type
sketch_jul27a:28: error: variable or field 'dump' declared void
sketch_jul27a:28: error: 'decode_results' was not declared in this scope
sketch_jul27a:28: error: 'results' was not declared in this scope

also i can do the thing in between the '//'

if some one could edit my code to make it work ill give out the following

arduino tutorials.HTML (24 tutorials) sketch up demo (not avalibal any where)

sketch up: you design a house or anything easy fast and like a pro in no time flat!

and possibly more if i can find any thing!!

IM DESPRATE

Okay, I’m game.
If you want me to fix your code i’ll give it a go; but in order to do so I’ll need some stuff from you, (just sent it as a message to me <–)

-Complete code as is
-Schematic of layout (how all the parts are connected, please no photos!)
-type of remote and type of IR sensor (3 pin or 2 pin)
-name of kit and place purchased from (not the Manuel)

Oh and as for that last little bit…

ill give out the following

Arduino tutorials.HTML (24 tutorials)
sketch up demo (not avalibal any where)

sketch up: you design a house or anything easy fast and like a pro in no time flat!

…if that’s suppose to be a bribe, don’t! were here to help without payment, it’s called service. and besides I don’t particularly want any of that.

Ok :cold_sweat:

the code is exsactly what i put above( i could not find any errors :blush: like the //-/ /) here are the exsact words to hook it up to the board:

Resistors: ? 220? resistance: 6

Built-in infrared receiver tube will launch tube out Qie weak optical signal into an electrical signal, this signal is amplified by the amplifier inside the IC, and then through automatic gain control, band pass filter, demodulator, waveform shaping restore the remote control transmitter out of the original encoded signal via the receiver input to the output pin coded identification on the electrical circuit.

When used to receive analog port VOUT, GND received experimental board GND, VCC received experimental board +5 v.

First, the board is connected; followed by the infrared receiver connected as described above, will receive digital 11 VOUT pin through a resistor connected to the LED lights digital pins 2,3,4,5,6,7. Sample Returning to complete the circuit part of the connection.

Remote control key:

A row a = 0x00FFA25D; a row of two = 0x00FFE01F; a row of three = 0x00FF629D;

Two rows of a = 0x00FFA857; two rows of two = 0x00FFE21D; two rows of three = 0x00FF906F;

Three rows of a = 0x00FF22DD; three rows of two = 0x00FF6897; three rows of three = 0x00FF02FD;

Four rows of a = 0x00FF9867; four rows of two = 0x00FFC23D; four rows of three = 0x00FFB047;

3 pin reciver link to photo of remote https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcSmGKkyaAivXBAZ5-6NN_iZLzn8M5J7rMG20v1zmT0pqw9nfuiM

ebay link http://www.ebay.com/itm/Starter-Kit-UNO-R3-Step-Motor-Servo-1602-LCD-Breadboard-LED-resistor-for-Arduino-/330923484628?pt=LH_DefaultDomain_0&hash=item4d0c93a5d4

also

thanks about the bribe thing im the in need :) :P

Okay thanks, I'll get right on it but it may take me a little bit (a day tops). In the mean time try out some of the examples that are part of the Arduino libraries (File>Examples) make sure you've got them down, if your just starting IR detection is a little complex. also if what i'm seeing in this kit is what you have you'll want to get the LCD display hooked up to the male pinheads (just solder them on with the long side facing down) those things can be fun to work with and all the info you need for them is in the Arduino examples (File>Examples>liquid Crystal). Let you know when I've got something.

Okay, I also need the manual.

thanks.

1) all those variables labeled "long" should be "long something" I don't know about hex so you'll have to figure it out by yourself.

I don't know what you mean there. They might be "unsigned long", but "long" looks OK to me

3) you can't declare a function before setup() (at least that's what I've found to be true) so you'll need to move all that stuff down to the bottom

You probably made another mistake elsewhere and assumed that to be the case, 'cos it just ain't so.

4)there's a bit of random variable deceleration [sic] between setup() and loop() so you'll need to move that, it can't go there. the program will never pick it up because the main() execution looks like this:

Can't really see why you've brought that up; you're just muddying the waters with a non sequitur.

@ OP, can I suggest you use the IDE's auto-format tool? It'll help you visualise your code structure better.

Include <IRremote.h>

Assuming that the spacing errors are due to some posting problem (or you’d get a lot MORE errors), you still need to spell
#include” correctly - it had to be all lower case

#include <IRremote.h>

(also, you MIGHT have it installed in the wrong place. Unfortunately, Arduino supresses errors about non-existent included files, for some reason.)

Since the include is wrong, you’re not importing the IRremote definitions, so it doesn’t know what a “decode_results” is.

staressent: 3) you can't declare a function before setup() (at least that's what I've found to be true) so you'll need to move all that stuff down to the bottom

Yes, you can.

void foo ()
  {
  Serial.println ("Hello, world.");
  }

void setup ()
  {
  Serial.begin (115200);
  foo ();
  }  // end of setup

void loop () { }

4)there's a bit of random variable deceleration between setup() and loop() so you'll need to move that, it can't go there. the program will never pick it up ...

That's complete nonsense, sorry.

well, i can do the best i can but the manual is an HTML page that i downloaded from the internet. A link to the page is below

http://www.4shared.com/document/qfu9nGql/Translated_version_of_Arduino_.html

you have to make a account but you can do a lot with it. its free.

Did you fix the #include and the other stuff?

no i will now!!

thanks

i + +that's another

just checked

its a posting problem along with the //-/ / thing

thanks anyway

what the space in between them or that theirs 2

i + +

OP please read http://www.catb.org/esr/faqs/smart-questions.html

Okay, I tried to get the manual and couldn’t, can you just e-mail it to me at < plaint-text email removed > i’ll be able to look it over.

Oh and about my mistakes forgive me, I’v just never been able to do any of those things in the past when i tried.
ie.

  1. you can’t declare a function before setup() (at least that’s what I’ve found to be true) so you’ll need to move all that stuff down to the bottom

4)there’s a bit of random variable deceleration between setup() and loop() so you’ll need to move that, it can’t go there. the program will never pick it up …

(oh and as for the “long” variables, I guess I’ve just never seen it like that)

oh and by the way…

can I suggest you use the IDE’s auto-format tool? It’ll help you visualise your code structure better.

Auto format won’t work if you have too many left brackets, which he did/does

On the other hand, you can be sure if the code doesn't auto-format, it won't compile either, so it's a win-win. ;)