Sketching Things Out

Before we start writing code, we first need to make sure we can communicate with the Arduino. Then we will learn how to collect and act upon data sent by the flex sensor with a program (what the Arduino community prefers to call a sketch).

The first sketch we write will detect when the flex resistor values have changed. If the change is large enough (in other words, if water is making the resistor bend), we will transmit a request to a PHP server that will process the request. That server will then send out an email notifying us of the change.

We will build the sketch incrementally, first by connecting the flex sensor to the Arduino and collecting values when the sensor is straight and then when it bends in both directions. ...

Get Programming Your Home now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.