Sensor for no water?

LarryD: I hope you didn't spend too much time at writing that sketch.

Post your sketch when you get to your computer. .

Ok

LarryD:
I hope you didn’t spend too much time at writing that sketch.

Post your sketch when you get to your computer.
.

void setup() {

pinMode(10, OUTPUT);

}

void loop() {

tone(10, 1000, 4000);

delay(2000);

}

You don't need this as the tone function does it for you: pinMode(10, OUTPUT);

Not sure what you are trying to do but this will beep every 1 second for 500ms In the final sketch you do not want to use delay() as it freezes code execution for that time. tone(10, 1000, 500); delay(1000);

LarryD: You don't need this as the tone function does it for you: pinMode(10, OUTPUT);

Not sure what you are trying to do but this will beep every 1 second for 500ms In the final sketch you do not want to use delay() as it freezes code execution for that time. tone(10, 1000, 500); delay(1000);

so like this ?

void setup() {

}

void loop() {

tone(10, 1000, 50);

}

setup() 
{

}

void loop() 
{
  tone(10, 1000, 500); //make a 1000hz tone for 1/2 second
  delay(1000) //wait one second, but in the final sketch, you will have replace this with other code
}

LarryD: ``` setup() {

}

void loop() {   tone(10, 1000, 500); //make a 1000hz tone for 1/2 second   delay(1000) //wait one second, but in the final sketch, you will have replace this with other code }

So would i still use this sketch? |500x228

I assume you want to make the piezo speaker beep when water is detected. The schematic uses pin 13 to drive the piezo not pin 10.

In your final sketch, you want to read the level on pin 10. When the read is LOW you then: tone(13,1000,500); every one second. loop() runs over and over, as long as pin 10 is LOW, you allow beeping. .

Edit To get beeping for no water, check pin 10 for a HIGH. .

LarryD:
I assume you want to make the piezo speaker beep when water is detected.
The schematic uses pin 13 to drive the piezo not pin 10.

In your final sketch, you want to read the level on pin 10.
When the read is LOW you then: tone(13,1000,500); every one second.
loop() runs over and over, as long as pin 10 is LOW, you allow beeping.
.

Edit
To get beeping for no water, check pin 10 for a HIGH.
.

So i am working on the project right now except i don’t know what sensor it is.

All you need is two wires (un insulated at the ends) put into the glass of water. .

A professional approach is to build the circuit using Float Switches. Float switches are simple level switches, which can be used to detect water levels. You can use the state of this switch to detect "no water"

Float Switch reference - https://en.wikipedia.org/wiki/Float_switch