NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

unsigned int c = 0;
unsigned char pass[4];
unsigned char cpass[4] = {'1', '2', '3', '4'};
int passcorrect = 0;
int alarm=0;
int mot=0;

void setup() {
  // put your setup code here, to run once:
  Serial.begin(115200);
  pinMode(7, INPUT);
  pinMode(13, HIGH);
}

void loop() {
  // put your main code here, to run repeatedly:
  if (digitalRead(7)&&(mot==0))
  {
    Serial.println("Hareket Algilandi!");
    alarm=1;
    mot=1;
  }
  if (!digitalRead(7)&&(mot==1))
  {
    mot=0;
  }
  if (Serial.available() > 0)
  {
    if (Serial.available() == 4)
    {
      int passcorrect = 1;
      for (int i = 0; i < 4; i++)
      {
        pass[i] = Serial.read();
        if (pass[i] != cpass[i])
        {
          passcorrect = 0;
        }
      }
      if (passcorrect == 1)
      {
        Serial.println("Alarm Sifirlandi.");
        alarm=0;
      }
      else
      {
        Serial.println("Sifre yanlis");
      }
    }
    else
    {
      Serial.println("Yanlis uzunlukta sifre");
      while (Serial.available() > 0)
      {
        int trash = Serial.read();
      }
    }
  }
  c++;
  delay(1);
  if ((c<500)&&(alarm==1))
  {
    digitalWrite(13,HIGH);
  }
  else
  {
    digitalWrite(13,LOW);
  }
  if (c >= 1000)
  {
    Serial.print("TMP");
    Serial.println(analogRead(0));
    c = 0;
  }
}

//******\

void flush()
{
  while(Serial.available()>0)
  {
    int trash=Serial.read();
  }
}
void setup()
{
  pinMode(13, OUTPUT);
  Serial.begin(9600);
}
void loop()
{
  delay(10);
  if(Serial.available()>0)
  {
    if(Serial.available()>1)
    {
      Serial.println("Komut Fazla Uzun");
      flush();
    }
    else
    {
      char data=Serial.read();
      if(data==49)
      {
        digitalWrite(13,HIGH);
        Serial.println("LED Acik");
      }
      else if(data==48)
      {
        digitalWrite(13,LOW);
        Serial.println("LED Kapali");
      }
      else
      {
        Serial.println("Komut taninmadi");
      }
    }
  }
}

//******\

float v;
void setup()
{
  Serial.begin(9600);
}
void loop()
{
  Serial.print("Voltaj: ");
  v=analogRead(0);
  Serial.println((v/1024)*5);
  delay(100);
}

//******\

int ledstate = 0;
void flush()
{
  while (Serial.available())
  {
    int trash = Serial.read();
  }
}
void setup()
{
  pinMode(6, OUTPUT);
  pinMode(5, OUTPUT);
  pinMode(4, INPUT);
  Serial.begin(9600);

void loop()
{
  delay(10);
  if (digitalRead(4))
  {
    while (digitalRead(4));
    if (ledstate == 0)
    {
      digitalWrite(6, HIGH);
      ledstate = 1;
      Serial.println("LED acildi");
    }
    else
    {
      digitalWrite(6, LOW);
      ledstate = 0;
      Serial.println("LED kapatildi");
    }
  }
  if (Serial.available() > 0)
  {
    if (Serial.available() > 1)
    {
      Serial.println("Komut Fazla Uzun");
      flush();
    }
    else
    {
      char data = Serial.read();
      if (data == 49)
      {
        digitalWrite(5, HIGH);
        Serial.println("LED Acik");
      }
      else if (data == 48)
      {
        digitalWrite(5, LOW);
        Serial.println("LED Kapali");
      }
      else if ((data == 'V') || (data == 'v'))
      {
        Serial.print("Voltaj: ");
        float v = analogRead(0);
        Serial.println((v / 1024) * 5);
      }
      else
      {
        Serial.println("Komut taninmadi");
      }
    }
  }
}

//******\

float adc;
unsigned char pass[4];
unsigned char cpass[4] = {'1', '2', '3', '4'};
unsigned char bflag = 0, pflag = 0, passcorrect = 0;
void setup()
{
  Serial.begin(115200);
  pinMode(9, OUTPUT);
  pinMode(6, INPUT);
}
void loop()
{
  delay(10);
  adc = analogRead(0);
  adc = ((adc / 1024) * 300) + 30;
  if ((adc < 40) || (adc > 320))
  {
    digitalWrite(9, HIGH);
  }
  if (digitalRead(6) && (bflag == 0))
  {
    bflag = 1;
    pflag = 1;
    Serial.println("Sifreyi girin");
  }
  if ((!digitalRead(6)) && (bflag == 1))
  {
    bflag = 0;
  }
  if ((pflag == 1) && (Serial.available() > 0))
  {
    pflag=0;
    if (Serial.available() == 4)
    {
      passcorrect = 1;
      for (int i = 0; i < 4; i++)
      {
        pass[i] = Serial.read();
        if (pass[i] != cpass[i])
        {
          passcorrect = 0;
        }
      }
      if (passcorrect == 1)
      {
        digitalWrite(9, LOW);
        Serial.println("Alarm kapatildi");
      }
      else
      {
        Serial.println("Yanlis sifre");
      }
    }
    else
    {
      Serial.println("Yanlis uzunluk");
      while (Serial.available() > 0)
      {
        int trash = Serial.read();
      }
    }
  }
  else if (Serial.available() > 0)
  {
    while (Serial.available() > 0)
    {
      int trash = Serial.read();
    }
  }
}
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.