Erorr

Hi,
I am trying to program a IR sensor and am getting the following error. I have the code also. I have tried changing everything and cannot seem to figure out what the error is saying.

expected constructor, destructor, or type conversion before '(' token

pinMode(IRledPin, OUTPUT);

pinMode(IRledPin, OUTPUT);

Serial.begin(9600);
}

void loop()
{
SendChannelUpCode();

delay(20*1000); // wait twenty seconds (20 seconds * 1000 milliseconds) Change this value for different intervals.
}

// This procedure sends a 38KHz pulse to the IRledPin
// for a certain # of microseconds. We'll use this whenever we need to send codes
void pulseIR(long microsecs) {
// we'll count down from the number of microseconds we are told to wait

cli(); // this turns off any background interrupts

while (microsecs > 0) {
// 38 kHz is about 13 microseconds high and 13 microseconds low
digitalWrite(IRledPin, HIGH); // this takes about 3 microseconds to happen
delayMicroseconds(10); // hang out for 10 microseconds
digitalWrite(IRledPin, LOW); // this also takes about 3 microseconds
delayMicroseconds(10); // hang out for 10 microseconds

// so 26 microseconds altogether
microsecs -= 26;
}

sei(); // this turns them back on
}

void SendChannelUpCode() {
// This is the code for the CHANNEL + for the TV COMCAST

delayMicroseconds(36328); //Time off (LEFT column)
pulseIR(280); //Time on (RIGHT column) <-------DO NOT

Looks like you're missing the start of setup()? You have the closing } after Serial.begin but no

void setup()
{

to say where it starts.

You've already been asked twice in your last post to use code tags. If you won't make the effort to format the post according to the forum rules why should we make the effort to help you with your problem?

Please use code tags (</> button on the toolbar) when you post code or warning/error messages. The reason is that the forum software can interpret parts of your code as markup, leading to confusion, wasted time, and a reduced chance for you to get help with your problem. This will also make it easier to read your code and to copy it to the IDE or editor. Using code tags and other important information is explained in the How to use this forum post. Please read it.

Please always do a Tools > Auto Format on your code before posting it. This will make it easier for you to spot bugs and make it easier for us to read.

im sorry, im new and dont know how yo use code tags.

Hi,
Welcome to the forum.

Please read the first post in any forum entitled how to use this forum.
http://forum.arduino.cc/index.php/topic,148850.0.html then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.

Thanks.. Tom.. :slight_smile: