Xbee doorbell project

When you press a start button, the arduino picks a random 4 diget code and flashes lights to show the code. When you repeat the code in the other buttons, the XBee will send a message to the other XBee, which will ring the bell. int bell=5; void setup(){ pinMode(bell, OUTPUT); Serial. begin(9600); } void loop(){ if(Serial. available()>0){ if(Serial. read()=`D`)
Xbee doorbell project - schematic

{ for(int i=0;i<=6;i+){ digitalWrite(bell, HIGH); delay(20); digitalWrite(bell, LOW); delay(20); } Serial. print(`K`); } } } #include Button btn1 = Button(10, PULLDOWN); Button btn2=Button(9, PULLDOWN); Button btn3=Button(8, PULLDOWN); Button btn4=Button(7, PULLDOWN); Button startBtn=Button(2, PULLUP); int numInPattern=4; boolean correct=false; int red=11; // store last time LED was updated long previousMillis = 0; // interval at which to blink (milliseconds) long interval = 1000; int pattern[4]={ }; int match[4]={ }; int count=0; int captureBtns=0; void setup(){ pinMode(red, OUTPUT); Serial. begin(9600); randomSeed(analogRead(0); for(int i=3;i<=6;i+){ pinMode(i, OUTPUT); } } void loop(){ //press the start btn to reset the pattern if(startBtn. uniquePress(){ // read input value and store it in val pickPattern(); } //check if user has pressed the number of buttons in pattern if (captureBtns=numInPattern) { //check if the patterns match checkCombo(); } //once pattern is selected, start capturing button presses startMatching(); } void pickPattern(){ for(int i=0;i
Visit page

Leave Comment

characters left:

New Circuits