#include "SPI.h"
#include <Adafruit_ILI9341.h>
#define TFT_DC 10
#define TFT_CS 9
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC);
int n;
int z;
int x=1;
int a;
int b=0;
int up;
int down;
int enter;
void setup()
{
Serial.begin(115200);
tft.begin();
// reset the scale to 0
}
void loop()
{
up = digitalRead(2);
down = digitalRead(3);
enter = digitalRead(4);
if(a<1)
{
a = 1;
x=a;
}
if(a>n)
{
a= n;
}
if(up==1)
{
tft.fillScreen(ILI9341_BLACK);
delay(500);
if(a==1;a<10)
{
a=a-1;
if(a>0)
{
x=a;
}
}
}
if(down==1)
{
delay(100);
tft.fillScreen(ILI9341_BLACK);
if(a>0;a<10)
{
a=a+1;
x=a;
}
}
if(b==0)
{
startscreen();
}
if(b==1)
{
mainmenu();
}
if(b==2)
{
option1();
}
if(b==3)
{
option2();
}
if(b==4)
{
option3();
}
if(b==5)
{
option4();
}
Serial.println(up);
Serial.println(down);
Serial.println(enter);
up = digitalRead(2);
down = digitalRead(3);
enter = digitalRead(4);
}
unsigned long mainmenu()
{
n=4;
unsigned long start = micros();
tft.setCursor(10, 10);
tft.setTextColor(ILI9341_WHITE); tft.setTextSize(2.5);
tft.println("MAIN MENU");
tft.setCursor(10, 40);
tft.setTextColor(ILI9341_YELLOW); tft.setTextSize(2.5);
tft.println("1) BACK");
tft.setCursor(10, 80);
tft.setTextColor(ILI9341_YELLOW); tft.setTextSize(2.5);
tft.println("2) STARTERS");
tft.setCursor(10, 120);
tft.setTextColor(ILI9341_YELLOW); tft.setTextSize(2.5);
tft.println("3) MAINCOURSE");
tft.setCursor(10, 160);
tft.setTextColor(ILI9341_YELLOW); tft.setTextSize(2.5);
tft.println("4) TANDOORI");
tft.setCursor(10, 200);
tft.setTextColor(ILI9341_YELLOW); tft.setTextSize(2.5);
tft.println("5) DESSERT");
select2();
}
unsigned long option1()
{
n=3;
unsigned long start = micros();
tft.setCursor(10, 10);
tft.setTextColor(ILI9341_WHITE); tft.setTextSize(2.5);
tft.println("STARTERS");
tft.setCursor(10, 40);
tft.setTextColor(ILI9341_YELLOW); tft.setTextSize(2.5);
tft.println("1) CHICKEN CHRISPY ");
tft.setCursor(10, 80);
tft.setTextColor(ILI9341_YELLOW); tft.setTextSize(2.5);
tft.println("2) PANEER FRIED");
tft.setCursor(10, 120);
tft.setTextColor(ILI9341_YELLOW); tft.setTextSize(2.5);
tft.println("3) EGG FRIED RICE");
tft.setCursor(10, 160);
tft.setTextColor(ILI9341_YELLOW); tft.setTextSize(2.5);
tft.println("4) CHICKEN FRIED RICE");
tft.setCursor(10, 200);
tft.setTextColor(ILI9341_YELLOW); tft.setTextSize(2.5);
tft.println("5) BACK");
select2();
}
unsigned long option2()
{
n=4;
unsigned long start = micros();
tft.setCursor(10, 10);
tft.setTextColor(ILI9341_WHITE); tft.setTextSize(2.5);
tft.println("MAINCOURSE");
tft.setCursor(10, 40);
tft.setTextColor(ILI9341_YELLOW); tft.setTextSize(2.5);
tft.println("1)BACK");
tft.setCursor(10, 80);
tft.setTextColor(ILI9341_YELLOW); tft.setTextSize(2.5);
tft.println("2)PANEER FRIED RICE");
tft.setCursor(10, 120);
tft.setTextColor(ILI9341_YELLOW); tft.setTextSize(2.5);
tft.println("3)EGG FRIED RICE");
tft.setCursor(10, 160);
tft.setTextColor(ILI9341_YELLOW); tft.setTextSize(2.5);
tft.println("4)FRIED RICE");
tft.setCursor(10, 200);
tft.setTextColor(ILI9341_YELLOW); tft.setTextSize(2.5);
tft.println("5) CHICKEN BIRYANI");
select2();
}
unsigned long option3()
{
n=4;
unsigned long start = micros();
tft.setCursor(10, 10);
tft.setTextColor(ILI9341_WHITE); tft.setTextSize(2.5);
tft.println("TANDOORI");
tft.setCursor(10, 40);
tft.setTextColor(ILI9341_YELLOW); tft.setTextSize(2.5);
tft.println("1) BACK");
tft.setCursor(10, 80);
tft.setTextColor(ILI9341_YELLOW); tft.setTextSize(2.5);
tft.println("2) PANEER TANDOORI");
tft.setCursor(10, 120);
tft.setTextColor(ILI9341_YELLOW); tft.setTextSize(2.5);
tft.println("3) MUSHROOM TANDOORI");
tft.setCursor(10, 200);
tft.setTextColor(ILI9341_YELLOW); tft.setTextSize(2.5);
tft.println("4) CHICKEN TANDOORI");
select2();
}
unsigned long option4()
{
n=4;
unsigned long start = micros();
tft.setCursor(10, 10);
tft.setTextColor(ILI9341_WHITE); tft.setTextSize(2.5);
tft.println("DESSERT");
tft.setCursor(10, 40);
tft.setTextColor(ILI9341_YELLOW); tft.setTextSize(2.5);
tft.println("1) BACK");
tft.setCursor(10, 80);
tft.setTextColor(ILI9341_YELLOW); tft.setTextSize(2.5);
tft.println("2) JALEBEE");
tft.setCursor(10, 120);
tft.setTextColor(ILI9341_YELLOW); tft.setTextSize(2.5);
tft.println("3) ICE CREAM");
tft.setCursor(10, 200);
tft.setTextColor(ILI9341_YELLOW); tft.setTextSize(2.5);
tft.println("4) GULAB JAMUN");
select2();
}
unsigned long select2()
{
int y=(x*40)-2;
tft.drawRect(9, y ,150,20,ILI9341_YELLOW);
delay(500);
if(enter==1)
{
b=x;
z=1;
screenrefresh();
delay(500);
if(b==1;a==1)
{
if(enter==1)
{
b=0;
}
}
if(enter==1;a==1)
{
b=1;
}
}
}
unsigned long screenrefresh()
{
if(z=1)
{
tft.fillScreen(ILI9341_BLACK);
z=z-1;
}
}
unsigned long startscreen()
{
tft.fillScreen(ILI9341_WHITE);
tft.setCursor(20, 20);
tft.setTextColor(ILI9341_CYAN); tft.setTextSize(2.5);
tft.println("ORDER HERE");
delay(500);
if(enter==1)
{
b=1;
}
}
unsigned long select1()
{
if (a==1)
{
tft.drawRect(9,38,150,20,ILI9341_YELLOW);
delay(500);
if(enter==1)
{
b=1;
z=1;
}
}
if (a==2)
{
tft.drawRect(9,78,150,20,ILI9341_YELLOW);
delay(500);
if(enter==1)
{
b=2;
z=1;
}
}
if (a==3)
{
tft.drawRect(9,118,150,20,ILI9341_YELLOW);
delay(500);
if(enter==1)
{
b=3;
z=1;
}
}
if (a==4)
{
tft.drawRect(9,159,150,20,ILI9341_YELLOW);
delay(500);
if(enter==1)
{
b=4;
z=1;
}
}
if (a==5)
{
tft.drawRect(9,198,150,20,ILI9341_YELLOW);
delay(500);
if(enter==1)
{
b=5;
z=1;
}
}
}