Pages: [1]   Go Down
Author Topic: 12 button and lcd is a big problem  (Read 928 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

hi friends;

there is a my project about with lcd and 12 buttons

( I can't use keypad )

project details..

12 buttons is equal to each of them define a one city

1. boston
2. newyork


12. miami

Logged

Western New York, USA
Online Online
Faraday Member
**
Karma: 25
Posts: 4110
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
project details..

I think we need a few more details before we can be of much help.  After you select a city by pressing a button then what ... ?  If you want to display the name of the city then you might want to investigate using a 'lookup table'.

Don
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

are there calculator example with arduino ??

I m not found this web site
Logged

Central MN, USA
Offline Offline
Tesla Member
***
Karma: 64
Posts: 6893
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

If you can describe more details that are missing, maybe we can help. Not being able to use a keypad doesn't mean you can't connect your 12 buttons in a matrix way and use 7 digital io to address them. This way you can just use a keypad library on your buttons, no need to write your own code.
Logged


Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

my project code;

I want that  one button is equal to one city

and then only two city ( start city and final city ) in show that lcd until, pressed other two city

for example

miami (start city)
chigago ( final city)

then

new york (start city)
boston (final city )

ı want to this type because I want becoming dijkstra algorithm

..................



#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
 
               
int istanbul  = 24;                   
int ankara    = 26;                   
int izmir     = 28;             
int antalya   = 30;                   
int konya     = 32;                 
int adana     = 34;                 
int sinop     = 36;                   
int sivas     = 38;                 
int urfa      = 40;                   
int trabzon   = 42;                 
int kars      = 44;                   
int van       = 46; 

int valistanbul  = 0;                   
int valankara    = 0;                   
int valizmir     = 0;             
int valantalya   = 0;                   
int valkonya     = 0;                 
int valadana     = 0;                 
int valsinop     = 0;                   
int valsivas     = 0;                 
int valurfa      = 0;                   
int valtrabzon   = 0;                 
int valkars      = 0;                   
int valvan       = 0; 


void setup() {

  pinMode(istanbul, INPUT);     
  pinMode(ankara, INPUT);   
  pinMode(izmir, INPUT);   
  pinMode(antalya, INPUT);   
  pinMode(konya, INPUT);   
  pinMode(adana, INPUT);   
  pinMode(sinop, INPUT);   
  pinMode(sivas, INPUT);   
  pinMode(urfa, INPUT);   
  pinMode(trabzon, INPUT);   
  pinMode(kars, INPUT);   
  pinMode(van, INPUT);   
 
 
  Serial.begin(9600);
}
 void loop(){
   
  valistanbul = digitalRead(istanbul);  // isanbul butonu degeri
  delay(2);
  valankara = digitalRead(ankara);  // read 2nd pushbutton's input value
  delay(2);
  valizmir = digitalRead(izmir);  // read 3rd pushbutton's input value
  delay(2);
  valantalya = digitalRead(antalya);  // read 4th pushbutton's input value
  delay(2);
  valkonya = digitalRead(konya);  // isanbul butonu degeri
  delay(2);
  valadana = digitalRead(adana);  // read 2nd pushbutton's input value
  delay(2);
  valsinop = digitalRead(sinop);  // read 3rd pushbutton's input value
  delay(2);
  valsivas = digitalRead(sivas);  // read 4th pushbutton's input value
  delay(2);
  valurfa = digitalRead(urfa);  // read 2nd pushbutton's input value
  delay(2);
  valtrabzon = digitalRead(trabzon);  // read 3rd pushbutton's input value
  delay(2);
  valkars = digitalRead(kars);  // read 4th pushbutton's input value
  delay(2);
  valvan = digitalRead(van);  // read 4th pushbutton's input value
  delay(2);
 

   if (valistanbul== HIGH){
   
  lcd.setCursor(0, 0);
  lcd.print("IST");
  delay(555);
 
   }
   
    if (valankara== HIGH){
  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print("-ANK   ");
  delay (555);
  }
   
    if (valizmir== HIGH){
   
  lcd.setCursor(0, 0);
  lcd.print("IZM   ");
  }else {
    lcd.setCursor(0, 0);
  lcd.print("      ");
  delay (555);
}
   
    if (valantalya== HIGH){
   
  lcd.setCursor(0, 0);
  lcd.print("ANT   ");
  }else {
    lcd.setCursor(0, 0);
  lcd.print("      ");
delay(555);
  }
 
    if (valkonya== HIGH){
   
  lcd.setCursor(0, 0);
  lcd.print("KON   ");
  }else {
    lcd.setCursor(0, 0);
  lcd.print("      ");
  delay (555);
}
 
  if (valadana== HIGH){
   
  lcd.setCursor(0, 0);
  lcd.print("ADN   ");
  }else {
    lcd.setCursor(0, 0);
  lcd.print("      ");
delay(555); 
}
    if (valsinop== HIGH){
   
  lcd.setCursor(0, 0);
  lcd.print("SIN   ");
  }else {
    lcd.setCursor(0, 0);
  lcd.print("      ");
 delay (555);
 }
    if (valsivas== HIGH){
   
  lcd.setCursor(0, 0);
  lcd.print("SVS   ");
  }else {
    lcd.setCursor(0, 0);
  lcd.print("      ");
delay(555); 
}
 
    if (valurfa== HIGH){
   
  lcd.setCursor(0, 0);
  lcd.print("URF   ");
  }else {
    lcd.setCursor(0, 0);
  lcd.print("      ");
delay (555); 
}
    if (valtrabzon== HIGH){
   
  lcd.setCursor(0, 0);
  lcd.print("TRB    ");
  }else {
    lcd.setCursor(0, 0);
  lcd.print("      ");
delay (555); 
}
  if (valkars== HIGH){
   
  lcd.setCursor(0, 0);
  lcd.print("KAR   ");
  }else {
  lcd.setCursor(0, 0);
  lcd.print("      "); 
delay (555);
}
    if (valvan== HIGH){
   
  lcd.setCursor(0, 0);
  lcd.print(" VAN   ");
  }else {
  lcd.setCursor(0, 0);
  lcd.print("      ");
  }
  delay(555);
}
Logged

Central MN, USA
Offline Offline
Tesla Member
***
Karma: 64
Posts: 6893
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Ok, some online reading on the Dijkstra's algorithm plus you code made me believe you are trying to achieve the following with the LCD and 12 buttons:
Press one button (city) then another, the LCD displays the first city and the second city. Then you can do it again.

Please use the "#" button when posting code next time.

I'm pretty sure your code won't work. Here is my logic:

0) Clear selected cities
1) Sense all buttons
2) Any buttons pressed? Yes, store the button's city to "first city". No, back to 1.
3) Sense all buttons
4) Any buttons pressed? Yes, store the button's city to "second city". No, back to 3.
5) Now that both cities are selected, do something. Return to 0.

Sensing if a digital input is HIGH doesn't mean the button is pressed. It just means the button is held down. You want to act when a button is pushed and released, not when it is held down.

I suggest you use my phi_buttons library to handle buttons. But even before that, you should learn A) how to do for loops B) how to do array. Don't proceed before you know both A and B. I'm pretty sure other helpers would want you know A and B too before they seriously help you.
Logged


Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

thank you liudry

I must a lot of work and I have only 10 day smiley

if you find material about this project, are you  share with me?
Logged

Central MN, USA
Offline Offline
Tesla Member
***
Karma: 64
Posts: 6893
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

thank you liudry

I must a lot of work and I have only 10 day smiley

if you find material about this project, are you  share with me?

10 days to change from what you have to what you want is a bit short. I suggest you do say 3 buttons, find out what code you need to make 3 buttons work then go from there. If you try the full problem (12 buttons), you will meet difficulty too big to overcome. If you can write program that works with 3 buttons, you can expand from there.
Logged


Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

thank you liudry

I must a lot of work and I have only 10 day smiley

if you find material about this project, are you  share with me?

10 days to change from what you have to what you want is a bit short. I suggest you do say 3 buttons, find out what code you need to make 3 buttons work then go from there. If you try the full problem (12 buttons), you will meet difficulty too big to overcome. If you can write program that works with 3 buttons, you can expand from there.




absolutly you are true

but, I don't find examples with about near this project  (  3 buttons and near projects )

Logged

Central MN, USA
Offline Offline
Tesla Member
***
Karma: 64
Posts: 6893
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Can you try to write some code that will do the following with 3 buttons?

0) Clear selected cities
1) Sense all buttons
2) Any buttons pressed? Yes, store the button's city to "first city". No, back to 1.
3) Sense all buttons
4) Any buttons pressed? Yes, store the button's city to "second city". No, back to 3.
5) Now that both cities are selected, do something. Return to 0.

I don't know if anyone did exact project you want to do so you will have to write some code. If you can at least write something that might do the above steps, we can look at the code and see how to improve it.
Logged


Pages: [1]   Go Up
Jump to: