Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
H

Henry Liu

@Henry Liu
About
Posts
1
Topics
1
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • one Arduino with three door sensors and one buzzer sensor
    H Henry Liu

    Dear All :
    I have been looking around the forum for a solution, but haven't found. I have one Adruino uno, three door/window sensors , one buzzer sensor. One door sensor will be on my apartment front door, one door sensor will be on my bathroom door, one sensor will on window.

    The problem is that I don't know how to make the three sensor works independently? when someone open the door or window, the buzzer should be trigger and the Computer will show"Door 1/2 is opening" or "window is opening ".

    Now the three sensor is series. The code is that:


    const int buzzer = 3;
    const int sensor = 4;

    int state; // 0 close - 1 open wwitch

    void setup()
    {
    pinMode(sensor, INPUT_PULLUP);
    }

    void loop()
    {
    state = digitalRead(sensor);

    if (state == HIGH){
    	tone(buzzer, 400);
    }
    else{
    	noTone(buzzer);
    }
    delay(200);
    

    }


    What i am trying to do is have 3 door sensors running from one arduino uno as they will be in different door. I realise that this is probably some thing but how would i go about changing the code to make this happen?

    I appreciate any help. Thanks

    Best Regrads;

    My Project
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular