While logging data is great for science experiments, most security application require somebody to be notified in the event a sensor registers an abnormal value. This can be done by adding another function to your Google spreadsheet. Add the following function below your doGet function:
Code Breakdown
Authorize
Before you are able to send a text message, you will need to publish your app again. You will be prompted to authorize additional permissions, specifically the ability to send an email.
Send a Text Message
To test your function, choose your sendText function from the drop down menu.
![]() Then click the run button. It will take a few seconds before you receive the text message.
![]() To not spam yourself, you need to set some kind of flag that prevents the if statement from running over and over. Here is some example code that you can implement to the code that you already have. Put this code idea into your ARDUINO code. int flag = 0; if(condition is triggered & flag = 0) { flag = 1; run the rest of the function } else if(condition not triggered & flag = 1) flag = 0; } |