PLC I/O User Interface School Project Codes

User Interface Codes:

********************************


#include <Wire.h>

#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x27, 20, 4); //0x3f 0x27


uint8_t arrow[8] = {0x0, 0x04 , 0x06, 0x1f, 0x06, 0x04, 0x00, 0x00};


int counter = 0;

int page = 1;

int Ready = 1;

int submenu = 0;

int subsubmenu = 0;

int subsubsubmenu =0;

int last_counter = 0;

bool clk_State;

bool Last_State;

bool dt_State;

int pushed = 0;

int dubak = 0;

int buzzer = 6;

int var = 0;


#define push 10

#define RELAY1 7 //ac

#define RELAY2 5 //kapa

#define RELAY3 4 //mod

#define RELAY4 3 //sure


void setup() {

pinMode (push, OUTPUT);

pinMode (buzzer, OUTPUT);

pinMode (RELAY1, OUTPUT);

pinMode (RELAY2, OUTPUT);

pinMode (RELAY3, OUTPUT);

pinMode (RELAY4, OUTPUT);

lcd.init();

lcd.backlight();

lcd.home();


PCICR |= (1 << PCIE0);

PCMSK0 |= (1 << PCINT0);

PCMSK0 |= (1 << PCINT1);

DDRB &= B11111100;

Last_State = (PINB & B00000001);


lcd.clear();

lcd.setCursor(0, 0);

(0);

lcd.print(" Circle Electronic");

(0);

lcd.setCursor(0, 1);

lcd.print(" PLC User Interface ");

lcd.setCursor(11, 3);

lcd.print("Ver 1.24");

//openingMusic();

delay(1600);


lcd.clear();

lcd.setCursor(7, 0);

lcd.print("Circle");

lcd.setCursor(3, 1);

lcd.print("User Interface");

lcd.setCursor(0, 2);

lcd.print(" >English");

lcd.setCursor(0, 3);

lcd.print(" Turkce");

}


void loop() {




if ((last_counter > counter) || (last_counter < counter) || pushed)

{

Ready = 1;



if (submenu == 0)

{

if (0 <= counter && counter < 4)

{

var=1;

while(var==1){

buzzermenuaction();

break;

}

var=0;

lcd.clear();

lcd.setCursor(7, 0);

lcd.print("Circle");

lcd.setCursor(3, 1);

lcd.print("User Interface");

lcd.setCursor(0, 2);

lcd.print(" >English");

lcd.setCursor(0, 3);

lcd.print(" Turkce");

page = 1;

if (pushed)

{

pushed = 0;

}

}

if (5 < counter && counter < 10)