Project tutorial
Arduino Alarm System: SERENA

Arduino Alarm System: SERENA © GPL3+

An alarm control panel made with an Arduino MEGA and a 3.2" Touch Screen.

  • 3,001 views
  • 2 comments
  • 14 respects

Components and supplies

Apps and online services

About this project

I've seen many alarm systems before, checked them out, got to see how they work and I decided that I wanted to make my own. I mean, why not? Why not take something and make it even better? I mean, I am a computer engineer (an undergraduate, but that changes soon) after all.

And that's how this project came to life.

I checked out a lot of systems and what they can actually offer and I thought that it was a good idea to put all these functions (and some of my own) in a single Arduino board which will serve as the alarm's control panel.

Nothing tricky here, just bought the board itself along with a 3.2" Touch Screen. To make the screen work of course, I needed some libraries. So a big thank you to Henning Carlsen for all the libraries! Link to his website in the credits section.

The program

Now this took me a while to complete. Don't let the code confuse you, I always comment when necessary!

The alarm's main functions

I decided to include three different passwords. A 4-digit, a 5-digit and a 6-digit one. I know these are a lot, but in a future update I'll give the user the option to disable the 4-digit code.

  • The 4-digit pass is used to arm the alarm.
  • The 5-digit pass is used to partially disarm the alarm.
  • The 6-digit pass is used to completely disarm the alarm.

The alarm can also auto-arm itself. After you enter the 5-digit code the program will start a countdown (default 40 seconds). After this countdown is over, the alarm will be auto-armed. This can come pretty handy when you usually forget to arm the system.

Options Menu

In the options menu, you can change all three passwords, as well as the auto-arm time.

Future Updates

Future updates will include date/time settings, SD card support (in case there's a power failure and we don't want to lose data), the option to disable auto-arming, the option to disable the 4-digit pass and many more.

Showcase Video

Code

SERENA v.1.01Arduino
Just upload the code to your Arduino board.
Some comments are in Greek, this will change soon.
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//SERENA Alarm System
//Author: Michael Marinis
//Copyright (C)2016 Michael Marinis. All Rights Reserved
//Website: http://www.youtube.com/SauROnmiKE
//
//This is the SERENA Alarm System, a two-function alarm system which gives
//the user the ability to auto-arm the alarm, or manually arm it when the user wants to.
//
//This program requires the UTFT & URTouch libraries from Henning Karlsen and a compatible LCD
//screen with it's shield.
//
//
//////////VERSIONS//////////
//0.10a: First build, basic functions
//0.20a: Minor improvements
//0.30a: Pass Input and Confirmation for a new Manual-Arm Password is done (12/11/2016)
//0.40a: Pass Input and Confirmation for a new Auto-Arm Password is done (12/11/2016)
//1.00a: Completed Arm Password Input & Check (12/11/2016, 19:16)
//1.10a: Completed the menu when the system is armed (without sending a signal to a relay or something else). The time and date will be added later. The Disarm button is only added (13/11/2016, 13:04)
//1.20a: Programmed the "DISARM" button. It prompts to the 5-Digit password input. Password check is also done, which disarms the alarm (without sending a signal to a relay or something else) (13/11/2016, 14:15)
//1.21a: Fixed an issue where the user couldn't type any numbers after the password confirmation check. If the user pressed "NO", he/she couldn't then type a new password until the "CLEAR" button was presed. This is now fixed (14/11/2016, 13:32)
//1.22a: The countdown timer for the auto-arming is now complete (14/11/2016, 15:46)
//1.30a: Auto-Arm Menu is complete. The Auto-Arm Menu displays the seconds left for the arm to be auto-armed again. The full disarm menu will be accessed via a push button due to the library's limitations (14/11/2016, 21:42)
//1.31a: Changed the "buf" variable from "-1" to "0". This resolved the bug, where the first push of any number button wouldn't do anything (16/11/2016, 00:45)
//1.40b: Added the "SET ARM PASSWORD" button which allows the user to modify the 4-digit password used to arm the alarm (16/11/2016, 14:33)
//1.41b: The "BACK" buttons from the "SET AUTO-ARM PASS", now redirect to the second page of the options menu, instead of the first one (16/11/2016, 16:21)
//1.42b: Completed the third options menu. It contains the buttons "SET TIME" and "SET DATE" (16/11/2016, 16:37)
//1.43b: Fixed a bug where the clear button on the disarm pass input wouldn't actually reset the "autoinput" array (17/11/2016, 00:05)
//1.44b: The "SET AUTO-ARM PASS" button, will now prompt the user to the second options menu when the password is changed, instead of the first one (18/11/2016, 10:02)
//The changes will be logged until the final version 1.00. After 1.00, the changes will be logged in the SERENA_changelog.txt file.
//1.00: Design of the full disarm function. The function will require the 6-Digit password and will prompt to the main menu of the alarm program. A buzzer is heard with every click of a button (8/1/2017, 20:53)
//////////FUTURE VERSIONS//////////
// *IDEAS FOR NEW VERSIONS WILL BE PUT HERE*
//
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


#include <UTFT.h>
#include <URTouch.h>

UTFT  myGLCD(ITDB32WC, 38, 39, 40, 41);
URTouch  myTouch(6, 5, 4, 3, 2);

extern uint8_t SmallFont[];
extern uint8_t BigFont[];
extern uint8_t SevenSegNumFont[];
int x;
int y;
int armpass[4] = {1, 2, 3, 4};
int autopass[5] = {1, 2, 3, 4, 5};
int manualpass[6] = {1, 1, 1, 1, 1, 1};
int timeinput[4];
int arminput[4];
int autoinput[5];
int manualinput[6];
int autolength = 0;
int manuallength = 0;
int buzzerpin = 8;
int systarm = 9;
int serenapin = 10;
int buttonpin = 13;
int autoarmtime = 40;
int autoarmtimemem = autoarmtime;
int month = 1;
int day = 1;
int year = 2016;

//CUSTOM FUNCTIONS


void alarmtitle()
{
  myGLCD.setFont(SmallFont);
  myGLCD.setBackColor(0, 0, 0);
  myGLCD.clrScr();
  myGLCD.setColor(255, 255, 255);
  myGLCD.setBackColor(255, 0, 0);
  myGLCD.drawLine(0, 14, 319, 14);
  myGLCD.print("SERENA ALARM SYSTEM v.1.01", CENTER, 1);
}

void title()//SEPARATED BECAUSE THE NAME IS NOT WANTED SOME TIMES
{
  alarmtitle();
  myGLCD.print("BY MICHAEL MARINIS", CENTER, 30);
}


void drawbutton1()
{
  myGLCD.setColor(192, 192, 192);
  myGLCD.fillRoundRect(20, 60, 300, 100);
}


void drawbutton2()
{
  myGLCD.setColor(192, 192, 192);
  myGLCD.fillRoundRect(20, 120, 300, 160);
}


void drawdisarm()
{
  myGLCD.setColor(192, 192, 192);
  myGLCD.fillRoundRect(20, 180, 300, 220);
  myGLCD.setColor(0, 0, 0);
  myGLCD.setBackColor(192, 192, 192);
  myGLCD.setFont(BigFont);
  myGLCD.print("DISARM", CENTER, 193);
}


void drawback()
{
  myGLCD.setColor(192, 192, 192);
  myGLCD.fillRoundRect(20, 180, 150, 210);
  myGLCD.setBackColor(192, 192, 192);
  myGLCD.setColor(0, 0, 0);
  myGLCD.setFont(SmallFont);
  myGLCD.print("BACK", 70, 190);
}


void drawno()
{
  myGLCD.setColor(192, 192, 192);
  myGLCD.fillRoundRect(20, 180, 150, 210);
  myGLCD.setBackColor(192, 192, 192);
  myGLCD.setColor(0, 0, 0);
  myGLCD.setFont(SmallFont);
  myGLCD.print("NO", 80, 190);
}


void drawyes()
{
  myGLCD.setColor(192, 192, 192);
  myGLCD.fillRoundRect(170, 180, 300, 210);
  myGLCD.setBackColor(192, 192, 192);
  myGLCD.setColor(0, 0, 0);
  myGLCD.setFont(SmallFont);
  myGLCD.print("YES", 225, 190);
}


void drawnext()
{
  myGLCD.setColor(192, 192, 192);
  myGLCD.fillRoundRect(170, 180, 300, 210);
  myGLCD.setBackColor(192, 192, 192);
  myGLCD.setColor(0, 0, 0);
  myGLCD.setFont(SmallFont);
  myGLCD.print("NEXT", 220, 190);
}


void drawbuttons()
{
  myGLCD.clrScr();
  int z;
  myGLCD.setFont(SmallFont);
  for (z = 0; z < 3; z++)
  {
    myGLCD.setColor(255, 0, 0);
    myGLCD.fillRoundRect(20 + (z * 60), 15, 60 + (z * 60), 55);
    myGLCD.setColor(255, 255, 255);
    myGLCD.setBackColor(255, 0, 0);
    myGLCD.printNumI(z + 1, 37 + (z * 60), 30);
  }

  for (z = 0; z < 3; z++)
  {
    myGLCD.setColor(255, 0, 0);
    myGLCD.fillRoundRect(20 + (z * 60), 70, 60 + (z * 60), 110);
    myGLCD.setColor(255, 255, 255);
    myGLCD.setBackColor(255, 0, 0);
    myGLCD.printNumI(z + 4, 37 + (z * 60), 85);
  }

  for (z = 0; z < 3; z++)
  {
    myGLCD.setColor(255, 0, 0);
    myGLCD.fillRoundRect(20 + (z * 60), 125, 60 + (z * 60), 165);
    myGLCD.setColor(255, 255, 255);
    myGLCD.setBackColor(255, 0, 0);
    myGLCD.printNumI(z + 7, 37 + (z * 60), 140);
  }

  for (z = 0; z < 3; z++)
  {
    myGLCD.setColor(255, 0, 0);
    myGLCD.fillRoundRect(190, 15 + (z * 55), 290, 55 + (z * 55));
  }


  myGLCD.setColor(255, 0, 0);
  myGLCD.fillRoundRect(20, 175, 80, 205);
  myGLCD.setColor(255, 255, 255);
  myGLCD.setBackColor(255, 0, 0);
  myGLCD.printNumI(0, 48, 185);

  myGLCD.setColor(255, 255, 255);
  myGLCD.setBackColor(255, 0, 0);
  myGLCD.print("CLEAR", 221, 30);
  myGLCD.print("OK", 232, 85);
  myGLCD.print("BACK", 225, 140);
}


void optionsmenuend()
{
  myGLCD.clrScr();
  myGLCD.setFont(SmallFont);
  myGLCD.setColor(255, 255, 255);
  myGLCD.drawLine(0, 14, 319, 14);
  myGLCD.setBackColor(255, 0, 0);
  alarmtitle();
  myGLCD.setFont(SmallFont);
  myGLCD.setColor(255, 0, 0);
  myGLCD.setBackColor(0, 0, 0);
  myGLCD.print("OPTIONS MENU", CENTER, 20);
  drawbutton1();
  drawbutton2();
  drawback();
  myGLCD.setFont(SmallFont);
  myGLCD.setColor(255, 255, 255);
  myGLCD.setBackColor(255, 0, 0);
}


void optionsmenu()
{
  myGLCD.clrScr();
  myGLCD.setFont(SmallFont);
  myGLCD.setColor(255, 255, 255);
  myGLCD.drawLine(0, 14, 319, 14);
  myGLCD.setBackColor(255, 0, 0);
  alarmtitle();
  myGLCD.setFont(SmallFont);
  myGLCD.setColor(255, 0, 0);
  myGLCD.setBackColor(0, 0, 0);
  myGLCD.print("OPTIONS MENU", CENTER, 20);
  drawbutton1();
  drawbutton2();
  drawback();
  drawnext();
  myGLCD.setFont(SmallFont);
  myGLCD.setColor(255, 255, 255);
  myGLCD.setBackColor(255, 0, 0);
}


void drawoptions()
{
  myGLCD.setFont(BigFont);
  myGLCD.setColor(255, 0, 0);
  myGLCD.fillRoundRect(20, 70, 300, 120);
  myGLCD.setBackColor(255, 0, 0);
  myGLCD.setColor(255, 255, 255);
  myGLCD.print("OPTIONS", CENTER, 90);
}


void drawarm()
{
  myGLCD.setFont(BigFont);
  myGLCD.setColor(255, 0, 0);
  myGLCD.fillRoundRect(20, 140, 300, 190);
  myGLCD.setBackColor(255, 0, 0);
  myGLCD.setColor(255, 255, 255);
  myGLCD.print("ARM", CENTER, 160);
}


void printmonth(int i)
{
  myGLCD.setColor(255, 0, 0);
  myGLCD.setBackColor(0, 0, 0);
  myGLCD.setFont(BigFont);
  if (i == 1)
  {
    myGLCD.print("JANUARY", 95, 100);
  }

  if (i == 2)
  {
    myGLCD.print("FEBRUARY", 95, 100);
  }

  if (i == 3)
  {
    myGLCD.print("MARCH", 95, 100);
  }

  if (i == 4)
  {
    myGLCD.print("APRIL", 95, 100);
  }

  if (i == 5)
  {
    myGLCD.print("MAY", 70, 100);
  }

  if (i == 6)
  {
    myGLCD.print("JUNE", 95, 100);
  }

  if (i == 7)
  {
    myGLCD.print("JULY", 95, 100);
  }

  if (i == 8)
  {
    myGLCD.print("AUGUST", 95, 100);
  }

  if (i == 9)
  {
    myGLCD.print("SEPTEMBER", 95, 100);
  }

  if (i == 10)
  {
    myGLCD.print("OCTOBER", 95, 100);
  }

  if (i == 11)
  {
    myGLCD.print("NOVEMBER", 95, 100);
  }

  if (i == 12)
  {
    myGLCD.print("DECEMBER", 95, 100);
  }
}



//int updatedate(int d, int m, int y)
//{
//  if (y % 4 == 0)//DISEKTO ETOS
//  {
//    if ((m >= 0) && (m <= 13))
//  {
//    if (m == 1 || m == 3 || m == 5 || m == 7 || m == 8 || m == 10 ||  m == 12)
//      {
//        if ((d >= 0) && (d <= 32))
//        {
//          if (d == 0)
//          {
//            d = 31;
//          }
//
//          if (d == 32)
//          {
//            d = 1;
//          }
//        }
//      }
//    }
//  }//DISEKTO ETOS END
//}



int armupdate(int i, int armlength)
{
  if (armlength < 4)
  {

    if (armlength == 0)
    {
      arminput[0] = i;
      myGLCD.setColor(255, 0, 0);
      myGLCD.setBackColor(0, 0, 0);
      myGLCD.printNumI(arminput[0], 100, 185); //+35 gia kathe noumero meta
      digitalWrite(buzzerpin, HIGH);
      delay(50);
      digitalWrite(buzzerpin, LOW);
      return arminput[0];
    }

    if (armlength == 1)
    {
      arminput[1] = i;
      myGLCD.setColor(255, 0, 0);
      myGLCD.setBackColor(0, 0, 0);
      myGLCD.printNumI(arminput[1], 135, 185);
      digitalWrite(buzzerpin, HIGH);
      delay(50);
      digitalWrite(buzzerpin, LOW);
      return arminput[1];
    }

    if (armlength == 2)
    {
      arminput[2] = i;
      myGLCD.setColor(255, 0, 0);
      myGLCD.setBackColor(0, 0, 0);
      myGLCD.printNumI(arminput[2], 170, 185);
      digitalWrite(buzzerpin, HIGH);
      delay(50);
      digitalWrite(buzzerpin, LOW);
      return arminput[2];
    }

    if (armlength == 3)
    {
      arminput[3] = i;
      myGLCD.setColor(255, 0, 0);
      myGLCD.setBackColor(0, 0, 0);
      myGLCD.printNumI(arminput[3], 205, 185);
      digitalWrite(buzzerpin, HIGH);
      delay(50);
      digitalWrite(buzzerpin, LOW);
      return arminput[3];
    }

  }

}



int autoarmupdate(int i, int timelength)
{
  if (timelength < 5)
  {
    if (timelength == 1)
    {
      timeinput[0] = i;
      myGLCD.setColor(255, 0, 0);
      myGLCD.setBackColor(0, 0, 0);
      myGLCD.printNumI(timeinput[0], 100, 185);
      digitalWrite(buzzerpin, HIGH);
      delay(50);
      digitalWrite(buzzerpin, LOW);
      return timeinput[0];
    }

    if (timelength == 2)
    {
      timeinput[1] = i;
      myGLCD.setColor(255, 0, 0);
      myGLCD.setBackColor(0, 0, 0);
      myGLCD.printNumI(timeinput[1], 135, 185);
      digitalWrite(buzzerpin, HIGH);
      delay(50);
      digitalWrite(buzzerpin, LOW);
      return timeinput[1];
    }

    if (timelength == 3)
    {
      timeinput[2] = i;
      myGLCD.setColor(255, 0, 0);
      myGLCD.setBackColor(0, 0, 0);
      myGLCD.printNumI(timeinput[2], 170, 185);
      digitalWrite(buzzerpin, HIGH);
      delay(50);
      digitalWrite(buzzerpin, LOW);
      return timeinput[2];
    }

    if (timelength == 4)
    {
      timeinput[3] = i;
      myGLCD.setColor(255, 0, 0);
      myGLCD.setBackColor(0, 0, 0);
      myGLCD.printNumI(timeinput[3], 205, 185);
      digitalWrite(buzzerpin, HIGH);
      delay(50);
      digitalWrite(buzzerpin, LOW);
      return timeinput[3];
    }
  }
}



int autoupdate(int i, int autolength)
{
  if (autolength < 5)
  {

    if (autolength == 0)
    {
      autoinput[0] = i;
      myGLCD.setColor(255, 0, 0);
      myGLCD.setBackColor(0, 0, 0);
      myGLCD.printNumI(autoinput[0], 100, 185); //+35 gia kathe noumero meta
      digitalWrite(buzzerpin, HIGH);
      delay(50);
      digitalWrite(buzzerpin, LOW);
      return autoinput[0];
    }

    if (autolength == 1)
    {
      autoinput[1] = i;
      myGLCD.setColor(255, 0, 0);
      myGLCD.setBackColor(0, 0, 0);
      myGLCD.printNumI(autoinput[1], 135, 185);
      digitalWrite(buzzerpin, HIGH);
      delay(50);
      digitalWrite(buzzerpin, LOW);
      return autoinput[1];
    }

    if (autolength == 2)
    {
      autoinput[2] = i;
      myGLCD.setColor(255, 0, 0);
      myGLCD.setBackColor(0, 0, 0);
      myGLCD.printNumI(autoinput[2], 170, 185);
      digitalWrite(buzzerpin, HIGH);
      delay(50);
      digitalWrite(buzzerpin, LOW);
      return autoinput[2];
    }

    if (autolength == 3)
    {
      autoinput[3] = i;
      myGLCD.setColor(255, 0, 0);
      myGLCD.setBackColor(0, 0, 0);
      myGLCD.printNumI(autoinput[3], 205, 185);
      digitalWrite(buzzerpin, HIGH);
      delay(50);
      digitalWrite(buzzerpin, LOW);
      return autoinput[3];
    }

    if (autolength == 4)
    {
      autoinput[4] = i;
      myGLCD.setColor(255, 0, 0);
      myGLCD.setBackColor(0, 0, 0);
      myGLCD.printNumI(autoinput[4], 240, 185);
      digitalWrite(buzzerpin, HIGH);
      delay(50);
      digitalWrite(buzzerpin, LOW);
      return autoinput[4];
    }

    if (autolength == 5)
    {
      autoinput[5] = i;
      myGLCD.setColor(255, 0, 0);
      myGLCD.setBackColor(0, 0, 0);
      myGLCD.printNumI(autoinput[5], 275, 185);
      digitalWrite(buzzerpin, HIGH);
      delay(50);
      digitalWrite(buzzerpin, LOW);
      return autoinput[5];
    }

  }

}




int manualupdate(int i, int manuallength)
{
  if (manuallength < 6)
  {

    if (manuallength == 0)
    {
      manualinput[0] = i;
      //manuallength++;
      myGLCD.setColor(255, 0, 0);
      myGLCD.setBackColor(0, 0, 0);
      myGLCD.printNumI(manualinput[0], 100, 185); //+35 gia kathe noumero meta
      digitalWrite(buzzerpin, HIGH);
      delay(50);
      digitalWrite(buzzerpin, LOW);
      return manualinput[0];

    }

    if (manuallength == 1)
    {
      manualinput[1] = i;
      //manuallength++;
      myGLCD.setColor(255, 0, 0);
      myGLCD.setBackColor(0, 0, 0);
      myGLCD.printNumI(manualinput[1], 135, 185);
      digitalWrite(buzzerpin, HIGH);
      delay(50);
      digitalWrite(buzzerpin, LOW);
      return manualinput[1];
    }

    if (manuallength == 2)
    {
      manualinput[2] = i;
      //manuallength++;
      myGLCD.setColor(255, 0, 0);
      myGLCD.setBackColor(0, 0, 0);
      myGLCD.printNumI(manualinput[2], 170, 185);
      digitalWrite(buzzerpin, HIGH);
      delay(50);
      digitalWrite(buzzerpin, LOW);
      return manualinput[2];
    }

    if (manuallength == 3)
    {
      manualinput[3] = i;
      //manuallength++;
      myGLCD.setColor(255, 0, 0);
      myGLCD.setBackColor(0, 0, 0);
      myGLCD.printNumI(manualinput[3], 205, 185);
      digitalWrite(buzzerpin, HIGH);
      delay(50);
      digitalWrite(buzzerpin, LOW);
      return manualinput[3];
    }

    if (manuallength == 4)
    {
      manualinput[4] = i;
      //manuallength++;
      myGLCD.setColor(255, 0, 0);
      myGLCD.setBackColor(0, 0, 0);
      myGLCD.printNumI(manualinput[4], 240, 185);
      digitalWrite(buzzerpin, HIGH);
      delay(50);
      digitalWrite(buzzerpin, LOW);
      return manualinput[4];
    }

    if (manuallength == 5)
    {
      manualinput[5] = i;
      //manuallength++;
      myGLCD.setColor(255, 0, 0);
      myGLCD.setBackColor(0, 0, 0);
      myGLCD.printNumI(manualinput[5], 275, 185);
      digitalWrite(buzzerpin, HIGH);
      delay(50);
      digitalWrite(buzzerpin, LOW);
      return manualinput[5];
    }

  }

}

void setup()
{
  myGLCD.InitLCD();
  myGLCD.clrScr();

  myTouch.InitTouch();
  myTouch.setPrecision(PREC_EXTREME);
  pinMode(buzzerpin, OUTPUT);
  pinMode(systarm, OUTPUT);
  pinMode(serenapin, OUTPUT);
  digitalWrite(buzzerpin, HIGH);
  delay(1000);
  digitalWrite(buzzerpin, LOW);
  title();

  drawoptions();
  drawarm();

}

void loop()
{
  while (true)
  {
mainmenu:
    if (myTouch.dataAvailable())
    {
      myTouch.read();
      x = myTouch.getX();
      y = myTouch.getY();

      //OPTIONS BUTTON
      if ((x >= 20) && (x <= 300) && (y >= 70) && (y <= 120))
      {
options:
        optionsmenu();
        myGLCD.setBackColor(192, 192, 192);
        myGLCD.setColor(0, 0, 255);
        myGLCD.print("SET MANUAL-ARM PASSWORD", CENTER, 73);
        myGLCD.print("SET ARM PASSWORD", CENTER, 133);
        digitalWrite(buzzerpin, HIGH);
        delay(50);
        digitalWrite(buzzerpin, LOW);
        while (true)
        {
          if (myTouch.dataAvailable())
          {
            myTouch.read();
            x = myTouch.getX();
            y = myTouch.getY();

            //SET MANUAL PASSWORD BUTTON
            if ((x >= 20) && (x <= 300) && (y >= 60) && (y <= 100))
            {
              title();
              myGLCD.setBackColor(0, 0, 0);
              myGLCD.setColor(255, 0, 0);
              myGLCD.print("ENTER 6-DIGIT PASSWORD", CENTER, 119);
              drawback();
              drawnext();
              digitalWrite(buzzerpin, HIGH);
              delay(50);
              digitalWrite(buzzerpin, LOW);
              while (true)
              {
                if (myTouch.dataAvailable())
                {
                  myTouch.read();
                  x = myTouch.getX();
                  y = myTouch.getY();

                  if ((x >= 20) && (x <= 150) && (y >= 180) && (y <= 210))
                  {
                    digitalWrite(buzzerpin, HIGH);
                    delay(50);
                    digitalWrite(buzzerpin, LOW);
                    goto options;
                  }

                  if ((x >= 170) && (x <= 300) && (y >= 180) && (y <= 210))
                    //BUTTON MENU
                  {
                    for (int o = 0; o < 6; o++)
                    {
                      manualinput[o] = 0;
                    }
passinput:
                    int buf = 0;
                    myGLCD.setFont(SmallFont);
                    myGLCD.setColor(255, 255, 255);
                    myGLCD.drawLine(0, 14, 319, 14);
                    myGLCD.setColor(255, 255, 255);
                    drawbuttons();
                    digitalWrite(buzzerpin, HIGH);
                    delay(50);
                    digitalWrite(buzzerpin, LOW);
                    myGLCD.setFont(SevenSegNumFont);
                    myGLCD.setBackColor(0, 0, 0);


                    //akolouthei to while(true) & drawbuttons (TICK!)
                    while (true)
                    {
                      if (myTouch.dataAvailable())
                      {
                        myTouch.read();
                        x = myTouch.getX();
                        y = myTouch.getY();

                        //BUTTONS 1-3
                        if ((y >= 15) && (y <= 55))
                        {
                          if ((x >= 20) && (x <= 60)) //1
                          {
                            manualupdate(1, buf);
                            buf++;
                            delay(85);
                          }

                          if ((x >= 80) && (x <= 120)) //2
                          {
                            manualupdate(2, buf);
                            buf++;
                            delay(85);
                          }

                          if ((x >= 140) && (x <= 180)) //3
                          {
                            manualupdate(3, buf);
                            buf++;
                            delay(85);
                          }
                        }//BUTTONS 1-3 END


                        if ((y >= 70) && (y <= 110)) //BUTTONS 4-6
                        {
                          if ((x >= 20) && (x <= 60)) //4
                          {
                            manualupdate(4, buf);
                            buf++;
                            delay(85);
                          }

                          if ((x >= 80) && (x <= 120)) //5
                          {
                            manualupdate(5, buf);
                            buf++;
                            delay(85);
                          }

                          if ((x >= 140) && (x <= 180)) //6
                          {
                            manualupdate(6, buf);
                            buf++;
                            delay(85);
                          }
                        }//BUTTONS 4-6 END


                        if ((y >= 125) && (y <= 165)) //BUTTONS 7-9
                        {
                          if ((x >= 20) && (x <= 60)) //7
                          {
                            manualupdate(7, buf);
                            buf++;
                            delay(85);
                          }

                          if ((x >= 80) && (x <= 120)) //8
                          {
                            manualupdate(8, buf);
                            buf++;
                            delay(85);
                          }

                          if ((x >= 140) && (x <= 180)) //9
                          {
                            manualupdate(9, buf);
                            buf++;
                            delay(85);
                          }
                        }//BUTTONS 7-9 END

                        if ((x >= 20) && (x <= 80) && (y >= 175) && (y <= 205)) //0
                        {
                          manualupdate(0, buf);
                          buf++;
                          delay(85);
                        }

                        if ((x >= 190) && (x <= 290) && (y >= 70) && (y <= 110)) //OK BUTTON
                        {
                          bool flag = true;
                          for (int t = 0; t < 6; t++)
                          {
                            if (manualinput[t] != manualpass[t])
                            {
                              flag = false;
                            }
                          }

                          if (flag == true) //swstos kwdikos
                          {
                            for (int i = 0 ; i < 6; i++)
                            {
                              manualinput[i] = 0;
                            }
                            myGLCD.clrScr();
                            myGLCD.setFont(BigFont);
                            myGLCD.print("PASS OK!" , CENTER , 100);
                            digitalWrite(buzzerpin, HIGH);
                            delay(50);
                            digitalWrite(buzzerpin, LOW);
                            delay(2000);
                            title();
                            myGLCD.setBackColor(0, 0, 0);
                            myGLCD.setColor(255, 0, 0);
                            myGLCD.print("ENTER NEW PASSWORD", CENTER, 119);
                            drawback();
                            drawnext();
                            while (true)
                            {
                              if (myTouch.dataAvailable())
                              {
                                myTouch.read();
                                x = myTouch.getX();
                                y = myTouch.getY();

                                int buf = 0;

                                //EISAGWGH NEOU KWDIKOU
                                if ((x >= 170) && (x <= 300) && (y >= 180) && (y <= 210))
                                {
newmanpassinput:
                                  myGLCD.setFont(SmallFont);
                                  myGLCD.setColor(255, 255, 255);
                                  myGLCD.drawLine(0, 14, 319, 14);
                                  myGLCD.setColor(255, 255, 255);
                                  drawbuttons();
                                  digitalWrite(buzzerpin, HIGH);
                                  delay(50);
                                  digitalWrite(buzzerpin, LOW);
                                  myGLCD.setFont(SevenSegNumFont);
                                  myGLCD.setBackColor(0, 0, 0);

                                  while (true)
                                  {
                                    if (myTouch.dataAvailable())
                                    {
                                      myTouch.read();
                                      x = myTouch.getX();
                                      y = myTouch.getY();

                                      //BUTTONS 1-3
                                      if ((y >= 15) && (y <= 55))
                                      {
                                        if ((x >= 20) && (x <= 60)) //1
                                        {
                                          manualupdate(1, buf);
                                          buf++;
                                          delay(85);
                                        }

                                        if ((x >= 80) && (x <= 120)) //2
                                        {
                                          manualupdate(2, buf);
                                          buf++;
                                          delay(85);
                                        }

                                        if ((x >= 140) && (x <= 180)) //3
                                        {
                                          manualupdate(3, buf);
                                          buf++;
                                          delay(85);
                                        }
                                      }//BUTTONS 1-3 END


                                      if ((y >= 70) && (y <= 110)) //BUTTONS 4-6
                                      {
                                        if ((x >= 20) && (x <= 60)) //4
                                        {
                                          manualupdate(4, buf);
                                          buf++;
                                          delay(85);
                                        }

                                        if ((x >= 80) && (x <= 120)) //5
                                        {
                                          manualupdate(5, buf);
                                          buf++;
                                          delay(85);
                                        }

                                        if ((x >= 140) && (x <= 180)) //6
                                        {
                                          manualupdate(6, buf);
                                          buf++;
                                          delay(85);
                                        }
                                      }//BUTTONS 4-6 END


                                      if ((y >= 125) && (y <= 165)) //BUTTONS 7-9
                                      {
                                        if ((x >= 20) && (x <= 60)) //7
                                        {
                                          manualupdate(7, buf);
                                          buf++;
                                          delay(85);
                                        }

                                        if ((x >= 80) && (x <= 120)) //8
                                        {
                                          manualupdate(8, buf);
                                          buf++;
                                          delay(85);
                                        }

                                        if ((x >= 140) && (x <= 180)) //9
                                        {
                                          manualupdate(9, buf);
                                          buf++;
                                          delay(85);
                                        }
                                      }//BUTTONS 7-9 END

                                      if ((x >= 20) && (x <= 80) && (y >= 175) && (y <= 205)) //0
                                      {
                                        manualupdate(0, buf);
                                        buf++;
                                        delay(85);
                                      }

                                      //EDW THA MPEI TO OK. THA RWTAW AN O KWDIKOS EINAI ENTAKSEI (2 KOUMPIA, YES & NO). AN "YES", TOTE THA EPISTREFEI STO ARXIKO MENOU, AN "NO" THA EPISTREFEI STHN EISAGWGH KWDIKOY
                                      if ((x >= 190) && (x <= 290) && (y >= 70) && (y <= 110))//NEW PASS OK BUTTON
                                      {
                                        buf = 0;
                                        myGLCD.clrScr();
                                        title();
...

This file has been truncated, please download it to see its full contents.

Comments

Similar projects you might like

DIY Arduino Fire Alarm System At Home

Project tutorial by Team MrModder

  • 16,130 views
  • 1 comment
  • 17 respects

Plant watering alarm system with arduino

Project tutorial by Giannis Arvanitakis

  • 3,709 views
  • 1 comment
  • 5 respects

Distance Alarm System

Project tutorial by Darwin Dela Cruz

  • 3,606 views
  • 3 comments
  • 17 respects

Buzzer Alarm System With Help Of Arduino

by Team ONYX

  • 37,920 views
  • 5 comments
  • 21 respects

Alarm System Security Put to the Test

Project tutorial by danionescu

  • 13,429 views
  • 4 comments
  • 23 respects

SERENA: Alarm Control Panel

Project tutorial by Michael Marinis

  • 6,895 views
  • 0 comments
  • 13 respects
Add projectSign up / Login