@davekw7x
I have not tested the code
As a followup to my incomplete post:
I managed to "borrow" a Parallax PIR sensor from a colleague who had obtained one to use with his Basic Stamp, but lost interest in the whole Basic thing. I hope it wasn't too late. See Footnote.
I experimented a little with a 'scope connected to the sensor's output pin (supplied with +5 volts and not connected to a microprocessor).
There is a little three-pin header. One end pin is marked "H" and the other is marked "L". A jumper is supplied. It was in the "H" position. I don't know whether this is how it came from the vendor or whether my friend put it in that position.
I did a quick wave of the hand. The output signal went high for a couple of seconds and then went low. I repeated the experiment a number of times and the high time varied from something like two seconds to something like four seconds..
Then I waved my hand continuously and found that the output signal went high and stayed high until I got tired. When I stopped waving, the signal went low (after a couple of seconds), then went high for a couple of seconds and finally stayed low.
I moved the jumper to the "L" position and did my wave stuff again.
A quick wave resulted in a high output for a couple of seconds and then low again.
Continuous waving resulted in a repeated sequence of high for a couple of seconds and low for about a second, high for a couple of seconds and low for about a second ....
I tried the playground sketch and it showed results consistent with the 'scope measurements.
I will mention that the 'scope did capture an occasional bounce of a few milliseconds or so when the output changed state, but since meaningful use requires state changes to be reported on a time frame of several seconds, it shouldn't affect any real application. I did not see any spurious (noisy) state changes at all.
The setup was an Arduino Duemilanove with the PIR sensor on a solderless breadboard, connected with jumper wires. I did not use any additional hardware decoupling.
Bottom line(s) for the original question:
1. The sensor output indicates motion when it is HIGH, not LOW.
2. Run the playground sketch and observe how it reports newly detected motion. Make absolutely sure that you understand what you are seeing and how it relates to the code.
3. For your application, use some kind of state timing mechanism (like that in the playground sketch) to send the e-mail message when motion is newly detected. Maybe you can just use the playground sketch itself with minor modifications regarding the content of the motion report message.
Regards,
Dave
Footnote:
"It is practically impossible to teach good programming to students
that have had a prior exposure to BASIC: as potential programmers
they are mentally mutilated beyond hope of regeneration."
--Edsger Dijkstra