#include<Stepper.h>
#include<LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,16,2);
Stepper mystepper(200,13,12,11,10);
int button1=4;
int p=HIGH;
int button2=3;
int led1=5;
int led2=7;
int pir=6;
int count =0;
void setup() {
// put your setup code here, to run once:
lcd.begin(16,2);
lcd.setCursor(3,1);
lcd.print("system is on");
delay (1000);
lcd .clear ();
pinMode(button1,INPUT );
pinMode(led1,OUTPUT );
pinMode(pir,INPUT );
pinMode(led2,OUTPUT );
pinMode(2,INPUT);
pinMode(button2,INPUT);
mystepper.setSpeed(60);
}
void loop() {
// put your main code here, to run repeatedly:
int b=digitalRead( button1);
int c=digitalRead(pir);
int d=digitalRead(2);
int e=digitalRead(button2);
/*if (b==LOW ){
lcd.print ("system off");delay (1);
lcd.clear();
digitalWrite (7,LOW );
digitalWrite (5,LOW );
mystepper.step(0);}*/
if (b==HIGH ){ digitalWrite (led1,HIGH);
//if(led1==HIGH){
lcd.print("leady to count ");
delay(1000);
lcd.print(count);
delay (1000);
lcd.clear ();}
if(c==HIGH ){
digitalWrite (7,HIGH );
lcd.print("motion ");
delay(100);
mystepper.step(10);
digitalWrite (7,LOW );
lcd.clear();}
/* else{
lcd.print("no-motion ");
delay(100); lcd.clear();
mystepper.step(0);
digitalWrite (7,LOW );}*/
if (e==HIGH){lcd.clear();
lcd.print ("system is off");delay(1000);
delay(1000);lcd.clear();
digitalWrite (7,LOW );delay(10);
digitalWrite (5,LOW );delay(10);
mystepper.step(0);}
}