Making an SMS water detector for a water tank, could use some help with the code

Hi, I got this code from here:

and i've played around with it. I admit that I have absolutely no idea what i'm doing as this is for a school project. I'm trying to make an SMS detector that detects if the water gets to the 7cm line, once it gets there it'll send a text. I could use some help as I have absolutely zero idea on what i'm doing.

edit: I put in some comments to help me understand some of the things there.

Attached is the sketch that I did.

sms_water_thing.ino (1.72 KB)

Start by getting rid of the serialEvent() function. I'm guessing you are trying to get it working by reading from the Serial port since you do nothing with ultrasonic ranging. Read this tutorial Serial Input Basics to get you started.

Install the NewPing library and look at those examples about how to use your sensor.

Hi,
Welcome to the forum.

Please read the post at the start of any forum , entitled "How to use this Forum".
OR
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: