Send SMS, when a letter drops by!


hello!

i sorry, if has been asked before, in need of project @ school!

i want following:

when physical letter drops pir motion sensor, sends sms phone.

i have following:

arduino uno board
parallax pir sensor (rev b) - http://learn.parallax.com/kickstart/555-28027
arduino gsm shield
working sim card.

i tested above example codes, check it's working.

the pir sensor can give me output of : id = 0 or 1. 1, when in front of it, , 0 when nothing blocking (no movement).

the problem persists of me writing code. have absolutely no idea if, doing honest, have managed example codes work, , have altered values in etc.

i don't want sms-flood, because pir sensor gives reading of 1's time.

how solve this.

i in desperate need of here - me started on it!

thank in advance!

best regards!

- thomas

/*
snail mail detector v1.0

initializes pir sensor , waits calibrate (30 secs)
checks pin 4 (pirpin) detect state change when digital pir sensor detects motion.
writes serial port motion detected alert message


*/
//libraries
#include gsm.h

//the time give sensor calibrate (10-60 secs according datasheet)
int calibrationtime = 30; // 30 seconds parallax pir
int pirpin = 4;      // pir sensor output connected pin 4
int pirstate = high; // initialize pir sensor state high
int val = 0;


void setup() {
   // initialize serial port:
   serial.begin(9600);
   pinmode(pirpin, input);

   // give sensor time calibrate
   serial.print("calibrating sensor ");
   for (int = 0; < calibrationtime; i++) {
      serial.print(".");
      delay(1000);
   }

   serial.println(" done");
   serial.println("sensor active");
   delay(30);

}

void loop() {

   // read arduino pin detect change in logic state
   // when motion detected, logic state should low
   // , high when there no motion detected
   val = digitalread(pirpin);

   if (val == low) {
      if (pirstate == high) {
         // have turned on
         serial.println("motion ended!");
         // want print on output change, not
         // state
         pirstate = low;
      }
   }
   else {
      if (pirstate == low) {
         serial.println("motion detected!");
         pirstate = high;
         
      }
   }
}

thats code use far. need implement send sms somehow, when motion has been detected, not flood phone texts.

for instance - if more letters drop in mailbox in timeframe of perhaps 2 minutes has detect once, , send 1 sms!


Arduino Forum > Using Arduino > Project Guidance > Send SMS, when a letter drops by!


arduino

Comments

Popular posts from this blog

invalid use of void expresion in FlexiTimer2 library

error: a function-definition is not allowed here before '{' token

LED Strip Code