Things used in this project

Custom parts and enclosures

boxdiagram.svg
caseplans_(1)_xTrMmVlVlP.svg

Code

Doorbell Box CodeArduino
Servo servo2_test;
Servo servo_test;
int analogvalue;            
void setup() {
pinMode(A0, INPUT);             // sets the pressure sensor pin as INPUT
servo_test.attach(D0);           //setting the pin numbers of each servo
servo2_test.attach(D1);
Particle.function("Servo", ServoToggle);
}
  
 void loop() {
 analogvalue = analogRead(A0);          //sets analoguevalue to read the pressure sensor pin
 
    if (analogvalue > 1) {                                  //states that if the pressure sensor pin at any point is greater than 1, then publish that doorbell is active 
                                                           
    Particle.publish("doorbell", "active",5, PRIVATE);
    }
    
 }
    
 int ServoToggle(String command) {              //in a seperate function of the box, if the comand COMING is sent to the photon (I use sms messaging), then turn the servos to change the message.
     if (command=="COMING"){
    {servo_test.write(0);                      //the speeds and timing of these servos will differ which each project
    }
     {servo2_test.write(0);
    }
    delay(8000);                                    //the general gist is that the servos turn to display the msaage on the paper, wait 30 seconds, return to their original position
    {servo_test.write(94);
 }
  {servo2_test.write(94);
    }
    delay(30000);
      {servo_test.write(180);
    }
     {servo2_test.write(180);
    }
    delay(8000);
    {servo_test.write(94);
 }
  {servo2_test.write(94);
    }
}
else if (command=="NOT HOME"){             //The same concept applies here, but the speeds and timing are adjusted so as to display the other message "Not Home"
    {servo_test.write(0);
    }
     {servo2_test.write(0);
    }
    delay(4500);
    {servo_test.write(94);
 }
  {servo2_test.write(94);
    }
    delay(30000);
      {servo_test.write(180);
    }
     {servo2_test.write(180);
    }
    delay(4500);
    {servo_test.write(94);
 }
  {servo2_test.write(94);
    }
}
}

Credits

Ef920256618518feb8b400464767aa2b
user354487
1 project • 0 followers
Contact

Replications

Did you replicate this project? Share it!

I made one

Love this project? Think it could be improved? Tell us what you think!

Give feedback

Comments

Add projectSign up / Login