tune programm

Hi, I am new in forum and arduino programming :) and i have a question, I want buzzer to beep once when my programm starts and when my programm end, i have already make the first tune but i cant do it whith second... pls help me

if (sensorValue==399){ tone(buzzer, 1000); // Send 1KHz sound signal... delay(1000); // ...for 1 sec noTone(buzzer); // Stop sound... delay(1000); // ...for 1sec }

That is not a tune I'd like to listen to for very long. But, anyway, from the fragment of your program which you have shown, the only thing to check is that the sensor value really is 399. If you show the whole program, you may get some more useful advice.

thanks for your answer, my programm i want to make a beep sound when the lights off and start to take temperature, and the led blink, when the light is on, my programm stop to make all this, and make a beep again. In my code , i can make the sound (beep) when lights off but i cant make it to beep when lights is on.

look my code :

void loop()
{

if (sensorValue==399){
tone(buzzer, 1000); // Send 1KHz sound signal…
delay(1000); // …for 1 sec
noTone(buzzer); // Stop sound…
delay(1000); // …for 1sec
}

if(sensorValue<400) {

digitalWrite(7, HIGH);
delay(1000);
digitalWrite(7, LOW);
delay(1000);
{

tempK = (analogRead(3) * 0.004882812 * 100)

Serial.print("Kelvin: "); Serial.println(tempK);

}
}
else {
digitalWrite(7, LOW); // set the LED off
}

}

look my code :

It made me barf. Why can't you use Tools + Auto Format, if you can't be bothered to properly indent as you go? Why can't you post code properly?

Why can't you post ALL of your code?

and:

are you sure that your sensor will produce exactly "399" and stay there while it is read? It might be smarter to give the "read" a small range to look at.

When you post the whole code, it would make much sense to tell us a bit more about your project goal and what kind of setup (sensor type etc.) you are going to use. Then we can better judge if the sensor is giving the "399" for long enough to get caught seriously by code.

Maybe follow your classmate's thread here for help: http://forum.arduino.cc/index.php?topic=408342.0 ;)

thank you all, i found it with your help , the link is very usefull

aarg: Maybe follow your classmate's thread here for help: http://forum.arduino.cc/index.php?topic=408342.0 ;)

Good one. I think this explains alot about why some posters are very shy about posting their code or saying what exactly they are trying to achieve, and being generally evasive when asked direct questions. They are worried that their class mates will snitch on them, or that teacher will find out some other way that their home work is not the product of honest toil.