can someone please tell me whats wrong here

ok so i need to do a combination of 3 circuits on the arduino uno. i decided to do led, buzzer, and a photo resister/light sensor controlling the brightness of a different led.
so heres my code:

const int sensorPin = 0;
const int ledPin = 10;
int buzzer = 8;
int led = 9;
int lightLevel, high = 0, low = 1023;


void setup()
{

  pinMode (buzzer, OUTPUT);
  pinMode(led, OUTPUT);
  pinMode (ledPin, OUTPUT);
}


void loop()
loop()
{
  {   {
 tone(buzzer, 262, 900);
 delay(1000);
 digitalWrite(led, HIGH);

 tone(buzzer, 700, 900);
 delay(1000);
 digitalWrite(led, LOW );

 tone(buzzer, 262, 900);
 delay(1000);
 digitalWrite(led, HIGH);

 tone(buzzer, 400, 900);
 delay(1000);
 digitalWrite(led, LOW); 
 }
  } 
 



{
  lightLevel = analogRead(sensorPin);


  manualTune();  
  
 

  analogWrite(ledPin, lightLevel);
  
  
}


void manualTune()
{
 

  lightLevel = map(lightLevel, 0, 1023, 0, 255);
  lightLevel = constrain(lightLevel, 0, 255);

} 


void autoTune()
{
 
  
  if (lightLevel < low)
  {
    low = lightLevel;
  }


  
  if (lightLevel > high)
  {
    high = lightLevel;
  }
 
  
  lightLevel = map(lightLevel, low+30, high-30, 0, 255);
  lightLevel = constrain(lightLevel, 0, 255);
  



}

dould you guys please fix it up and write a code that works. btw ledPin is the one tha will be getting dimmer and brightter and led is the one that will be blinking to the beat of the buzzer.

thanks guys

Moderator edit:
</mark> <mark>[code]</mark> <mark>

</mark> <mark>[/code]</mark> <mark>
tags added.

whyisarduinosohard - is because you refuse to read the how to use this forum sticky post.
http://forum.arduino.cc/index.php?topic=148850.0
It tells you how to post code correctly and what information you need for an answer.
You fall short in both departments.

i need to do a combination of 3 circuits on the arduino uno. i decided to do led, buzzer, and a photo resister/light sensor

Is this homework or a class assignment?

We can help but we will not do the work for you. We can point out where that code is wrong once it is posted correctly.

This is most likely an error or possibly a failed attempt at some awesome recursion

void loop()
loop()
{
  {   {

Note how the code is in a special code block? The regulars here get a bit persnickety when that convention is not followed.

There is also some interesting {}s floating around so you may want to look into that. If you have further questions place the new code in code blocks and tell us what the problem is (Code won't compile because of X, or Code does X instead of Y)

sorry for doing the post wrong but i a beginnerand have no idea what im doing. this is a project that im working on for myself.

so this is my code. im trying to get a buzzer to go on with an led and a light sensor wit a separate led to all work at the same time. sorry if it sin wrong formatting or something its my first day here.

const int sensorPin = 0;
const int ledPin = 10;
int buzzer = 8;
int led = 9;
int lightLevel, high = 0, low = 1023;


void setup()
{

  pinMode (buzzer, OUTPUT);
  pinMode(led, OUTPUT);
  pinMode (ledPin, OUTPUT);
}


void loop()


  {   
 tone(buzzer, 262, 900);
 delay(1000);
 digitalWrite(led, HIGH);

 tone(buzzer, 700, 900);
 delay(1000);
 digitalWrite(led, LOW );

 tone(buzzer, 262, 900);
 delay(1000);
 digitalWrite(led, HIGH);

 tone(buzzer, 400, 900);
 delay(1000);
 digitalWrite(led, LOW); 
 }
   
 



{
  lightLevel = analogRead(sensorPin);


  manualTune();  
  
 

  analogWrite(ledPin, lightLevel);
  
  
}


void manualTune()
{
 

  lightLevel = map(lightLevel, 0, 1023, 0, 255);
  lightLevel = constrain(lightLevel, 0, 255);

} 


void autoTune()
{
 
  
  if (lightLevel < low)
  {
    low = lightLevel;
  }


  
  if (lightLevel > high)
  {
    high = lightLevel;
  }
 
  
  lightLevel = map(lightLevel, low+30, high-30, 0, 255);
  lightLevel = constrain(lightLevel, 0, 255);
  
}

the errors are: combination_circuit_ino:42: error: expected unqualified-id before '{' token

Moderator edit:
</mark> <mark>[code]</mark> <mark>

</mark> <mark>[/code]</mark> <mark>
tags added.

@whyisarduinosohard, do not cross-post.

"whyisarduinosohard", Arduino is actually very easy, just try doing this stuff with blank chips and other tool chains.

What is this supposed to be

{
  lightLevel = analogRead(sensorPin);
  manualTune();  
  analogWrite(ledPin, lightLevel);
}

it's orphan code just stuck below loop(). Try moving it into the loop() function.


Rob

@jroorda:

The regulars here get a bit persnickety when that convention {ie code tags} is not followed

You make that seem like it's just to be awkward- and it's not. It's well nigh impossible to read code when it's in the normal style. Especially when the poster does a digitalRead from pin 8 since that appears like this:

digitalRead(8);

not this:

digitalRead(8);

for (int i = 0; i < x; i++)
dosomethingwith(myarray*);*
heh, why is everything in italics and there was no array index
as opposed to

for (int i = 0; i < x; i++)
     dosomethingwith(myarray[i]);

Rob

sorry if it sin wrong formatting or something its my first day here.

That is why we have a sticky post in every section called how to use this forum.
I would expect you to read it before posting, it will point out all the things you are doing wrong here.
Read it. Supply the relevant information, then we can all stop wasteing our time and get down to solving your problem.