Soak ’em Up

With this tool, no one will dare to annoy you by buzzing your doorbell for long…or no one will ever visit you again!






Process

Source Code for the Receiver


#include <NewSoftSerial.h>
NewSoftSerial mySerial(2,3);

/*
doorbell basic DINGY!!
by Rob Faludi faluudi.com
*/

#define VERSION "1.00a0"

boolean dumpWater = false;
int water = 7;

long previousMillis = 0;
long interval = 5000;
int BUTTON = 5;
int counter=0;

void setup(){
  pinMode(water, OUTPUT);
  pinMode(BUTTON, INPUT);
  pinMode(13,OUTPUT);
  mySerial.begin(9600);
}

void loop(){
  //look for a capital D over the serial port and ring the bell if found
  unsigned long currentMillis = millis();
  if(currentMillis - previousMillis > interval&&dumpWater==true) {
    dumpWater=false;
    digitalWrite(water, LOW);
    digitalWrite(13, LOW);
  }
  if(counter>=300){
      previousMillis = currentMillis;
      dumpWater=true;
      digitalWrite(water, HIGH);
      digitalWrite(13, HIGH);
      counter=0;
  }
  if (mySerial.available() > 0){
    if (mySerial.read() == 'W') {
        //ring bell briefly
        previousMillis = currentMillis;
        dumpWater=true;
        digitalWrite(water, HIGH);
        digitalWrite(13, HIGH);
        delay(10);
        
      }
    }
    if (digitalRead(BUTTON) == HIGH){
     mySerial.print('R');
     counter++;
     //digitalWrite(13,HIGH);
     delay(10); //prevents overwhelming the serial port
    }
}

Source Code for the Sender Button


#include <NewSoftSerial.h>

/*
doorbell basic BUTTON!!
by Rob Faludi faluudi.com
*/
NewSoftSerial mySerial(2,3);

#define VERSION "1.00a0"
boolean dumpWater=false;
int BUTTON = 5;
int resetButton = 8;
int bell = 7;



void setup(){
  pinMode(BUTTON, INPUT);
  pinMode(resetButton, INPUT);
  pinMode(bell, OUTPUT);
  pinMode(13,OUTPUT);
  mySerial.begin(9600);
}

void loop(){
  //send a capital D over the serial port if the button is pressed
  if(dumpWater==false){
    digitalWrite(13,HIGH);
  }else{
    digitalWrite(13,LOW);
  }
  if(digitalRead(resetButton)==HIGH && dumpWater==true){
    dumpWater=false;
  }
  if (digitalRead(BUTTON) == HIGH){
    if(dumpWater==false){
       mySerial.print('W');
       //digitalWrite(13,HIGH);
       delay(10); //prevents overwhelming the serial port
       dumpWater=true;
    }
  }
  if (mySerial.available() > 0&&dumpWater==false){
    if (mySerial.read() == 'R') {
        //ring bell briefly
        //previousMillis = currentMillis;
        //dumpWater=true;
        digitalWrite(bell, HIGH);
        //digitalWrite(13, HIGH);
        delay(10);
        digitalWrite(bell, LOW);
        
      }
    }
}

by Leif, Chris, Oylum