#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C Screen(0x27,16,2);
#define led1 8
#define led2 9
#define led3 10
#define led4 11
#include <Servo.h>
Servo ton;
#define But1 8
#define But2 9
#define But3 10
#define But4 11
void ML ()
{
ton.write(0);
}
void MN ()
{
ton.write(60);
}
void MA ()
{
ton.write (120);
}
void MK ()
{
ton.write(180);
}
void setup() {
// put your setup code here, to run once:
pinMode (led1,OUTPUT);
pinMode (led2 ,OUTPUT);
pinMode (led3 ,OUTPUT);
pinMode (led4 ,OUTPUT);
ton.attach(3);
pinMode (But1,INPUT );
pinMode (But2,INPUT );
pinMode (But3,INPUT );
pinMode (But4,INPUT );
}
void loop() {
// put your main code here, to run repeatedly:
int Fabio = digitalRead(But1);
int Facoe = digitalRead(But2);
int Fayou = digitalRead(But3);
int Fakot = digitalRead(But4);
if (Fabio==1 )
{
ML ();
}
if (Facoe ==1 )
{
MN ();
}
if (Fayou ==1 )
{
MA ();
}
if (Fakot ==1 )
{
MK ();
}
digitalWrite (led1 ,HIGH );
delay(300);
digitalWrite (led2 ,HIGH );
delay(300);
digitalWrite (led3 ,HIGH );
delay(300);
digitalWrite (led4 ,HIGH );
delay(300);
Screen .init();
Screen.backlight();
for(int i= 0 ; i<= 16; i++)
{
Screen.setCursor(i,0);
Screen.print("1 2 3 4 ");
delay (300);
Screen.clear();
}
}