loading
1Comments

Tell us about yourself!

Complete Your Profile
  • Android automatic open electric door with QR code scan

    please help me sirI try to add the PIR and alarm in your projectbut it doesn't workmy alarm always voiced.This is my sketch :#include <SoftwareSerial.h>SoftwareSerial Blue (8, 9);relayDoorlock int = 13; // Relay doorlock at pin 13statusRelay int = 0; // Status relay starting with 0inputPin int = 11; // Choose the input pin (for PIR sensor)int pirState = LOW; // We start, assuming no motion detectedint val = 0; // Variable for reading the pin statuspinSpeaker int = 10;String ReadString;void setup () {pinMode (inputPin, INPUT); // Declare sensor as an inputpinMode (pinSpeaker, OUTPUT);pinMode (relayDoorlock, OUTPUT); // Set Relay as outputBlue.begin (9600);}void loop () {statusRelay = digitalRead (relayDoorlock);while (Blue.available ()) {delay (3);char c = Blue.read ();ReadString +...see more »please help me sirI try to add the PIR and alarm in your projectbut it doesn't workmy alarm always voiced.This is my sketch :#include <SoftwareSerial.h>SoftwareSerial Blue (8, 9);relayDoorlock int = 13; // Relay doorlock at pin 13statusRelay int = 0; // Status relay starting with 0inputPin int = 11; // Choose the input pin (for PIR sensor)int pirState = LOW; // We start, assuming no motion detectedint val = 0; // Variable for reading the pin statuspinSpeaker int = 10;String ReadString;void setup () {pinMode (inputPin, INPUT); // Declare sensor as an inputpinMode (pinSpeaker, OUTPUT);pinMode (relayDoorlock, OUTPUT); // Set Relay as outputBlue.begin (9600);}void loop () {statusRelay = digitalRead (relayDoorlock);while (Blue.available ()) {delay (3);char c = Blue.read ();ReadString + = c;}val = digitalRead (inputPin); // Read input valueif (val == HIGH) {// check if the input is HIGHPlaytone (300, 160);delay (150);if (pirState == LOW) {// We have just turned onSerial.println ("Motion detected!");// We only want to print on the output change, not statepirState = HIGH;}} Else {Playtone (0, 0);delay (300);if (pirState == HIGH) {// We have just turned offSerial.println ("Motion ended!");// We only want to print on the output change, not state// Inside Of The Serial PortpirState = LOW;}}if (readString.length ()> 0) {Blue.println (ReadString);if (ReadString == "esvmxrplOa1KIpyn6BRk") // Change the Random string{digitalWrite (relayDoorlock, HIGH); // Turn on the relay for 30 secondsdigitalWrite (val, LOW);ReadString = "";}if (ReadString == "CxzJHRO9n1M5OMndUq2T") // Change the Random string{digitalWrite (relayDoorlock, LOW); // After 30 seconds, turn off the relaydigitalWrite (val, HIGH);ReadString = "";}}}// Tell Arduino To Play Piezo Buzzer Tone// In msecs duration, frequency in hertzvoid Playtone (long duration, int freq) {duration * = 1000;int period = (1.0 / freq) * 1000000;long elapsed_time = 0;while (elapsed_time <duration) {digitalWrite (pinSpeaker, HIGH);delayMicroseconds (period / 2);digitalWrite (pinSpeaker, LOW);delayMicroseconds (period / 2);elapsed_time + = (period);}}

    View Instructable »