Elevator

Greeatings .

I need some help with my project for elevator display.

I have 2 pushbuttons , they are my inputs .
Those 2 buttons will show me number of floor.
For example if the state of input 1 and input 2 are low on my display show floor zero.
if boot input high the foor is 3 .

have some one similary code

thanks a lot

Hi,
A table showing what you want to display with ALL combinations of the 2 inputs.

Button1 Button2 Display
LOW LOW 0
LOW HIGH 1
HIGH LOW 2
HIGH HIGH 3

Does it look familiar?

What is your electronics, programming, arduino, hardware experience?

What arduino are you using?
What display are you using?

Tom.... :slight_smile:

TomGeorge:
Hi,
A table showing what you want to display with ALL combinations of the 2 inputs.

Button1 Button2 Display
LOW LOW 0
LOW HIGH 1
HIGH LOW 2
HIGH HIGH 3

Does it look familiar?
What is your electronics, programming, arduino, hardware experience?

What arduino are you using?
What display are you using?

Tom.... :slight_smile:

i using arduino mega , and tft 3.2 sainsmart ITDB32S .
your table is correct for my project i need hel how can i read this input and show on my display .
i can with if else but i have to much case ?
have you better idea ?
I use UTFT library

Hi,
You are counting in binary..

Can you tell us your electronics, programming, Arduino, hardware experience?

i can with if else but i have to much case ?

Not sure what you mean.

Please post your code.

Tom.... :slight_smile:

TomGeorge:
Hi,
You are counting in binary..

Can you tell us your electronics, programming, Arduino, hardware experience?
Not sure what you mean.

Please post your code.

Tom.... :slight_smile:

#include <UTFT.h>

extern uint8_t SevenSegment96x144Num[];
extern uint8_t GroteskBold32x64[];

UTFT myGLCD(ITDB32S,38,39,40,41);
const int buttonPin = 8;
const int pin2=9;
const int pin3=10;
int buttonState = 0;
int stanje=0;
int stanje1=0;
int i = 0;
void jedan()
{
//delay(1);
myGLCD.fillScr(0,0,0);
myGLCD.setColor(255, 255, 255);
myGLCD.setBackColor(0, 0, 0);
myGLCD.setFont(SevenSegment96x144Num);
myGLCD.print("1", 90, 200,-90);

if(stanje1==HIGH)
{ myGLCD.setColor(255,0,0);
myGLCD.setFont(GroteskBold32x64);
myGLCD.print(">",100,20);
delay(500);
myGLCD.setFont(GroteskBold32x64);
myGLCD.print(">",150,20);
delay(500);
myGLCD.setFont(GroteskBold32x64);
myGLCD.print(">",200,20);
}}
void dva()
{
//delay(1);
myGLCD.fillScr(0,0,0);
myGLCD.setColor(255, 255, 255);
myGLCD.setBackColor(0, 0, 0);
myGLCD.setFont(SevenSegment96x144Num);
myGLCD.print("2", 90, 190,-90);

if(stanje1==HIGH)
{
myGLCD.setColor(255,0,0);
myGLCD.setFont(GroteskBold32x64);
myGLCD.print(">",100,20);
delay(500);
myGLCD.setFont(GroteskBold32x64);
myGLCD.print(">",150,20);
delay(500);
myGLCD.setFont(GroteskBold32x64);
myGLCD.print(">",200,20);
}

}

void tri()

{
//delay(1);
myGLCD.fillScr(0,0,0);
myGLCD.setColor(255, 255, 255);
myGLCD.setBackColor(0, 0, 0);
myGLCD.setFont(SevenSegment96x144Num);
myGLCD.print("3", 90, 190,-90);

if(stanje1==HIGH)
{
myGLCD.setColor(255,0,0);
myGLCD.setFont(GroteskBold32x64);
myGLCD.print(">",100,20);
delay(500);
myGLCD.setFont(GroteskBold32x64);
myGLCD.print(">",150,20);
delay(500);
myGLCD.setFont(GroteskBold32x64);
myGLCD.print(">",200,20);
}}
void nula()
{
//delay(1);
myGLCD.fillScr(0,0,0);
myGLCD.setColor(255, 255, 255);
myGLCD.setBackColor(0, 0, 0);
myGLCD.setFont(SevenSegment96x144Num);
myGLCD.print("0", 90, 180,-90);

if(stanje1==HIGH)
{
myGLCD.setColor(255,0,0);
myGLCD.setFont(GroteskBold32x64);
myGLCD.print(">",100,20);
delay(500);
myGLCD.setFont(GroteskBold32x64);
myGLCD.print(">",150,20);
delay(500);
myGLCD.setFont(GroteskBold32x64);
myGLCD.print(">",200,20);
delay(5000);
}

}
void setup() {
myGLCD.InitLCD();
myGLCD.clrScr();
pinMode(buttonPin, INPUT_PULLUP);
pinMode(pin2,INPUT_PULLUP);
pinMode(pin3,INPUT_PULLUP);
}

void loop() {

//myGLCD.clrScr();
buttonState = digitalRead(buttonPin);
stanje = digitalRead(pin2);
stanje1=digitalRead(pin3);
if (buttonState == HIGH && stanje==LOW) {
jedan();
}
else if (buttonState==LOW && stanje==HIGH){
dva();
}
else if(buttonState==HIGH && stanje==HIGH){
tri();
}
else if(buttonState==LOW && stanje==LOW)
{
nula();
}

}

Hi,
Please read the first post in any forum entitled how to use this forum.
http://forum.arduino.cc/index.php/topic,148850.0.html then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.

Thanks.. Tom.. :slight_smile:

this is my code

displej2.ino.ino (3.04 KB)

TomGeorge:
Hi,
Please read the first post in any forum entitled how to use this forum.
http://forum.arduino.cc/index.php/topic,148850.0.html then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.

Thanks.. Tom.. :slight_smile:

i needsomthing like this

on this video you can see m1 m2 m3 m4 are inputs and the output on display are dec