Show Posts
Pages: 1 ... 7 8 [9] 10 11 ... 40
121  Using Arduino / Programming Questions / Re: Call a function from main once @ time on: March 01, 2014, 02:48:43 am
I don't know how to do that. give example program.
It is difficult because you have not posted all your code but the function displays something. Use a variable to save the value of that something you have just displayed. Then at the start of the function use an if statement to compair the current thing you want to display with what you displayed last. Only actually write to the LCD if these are not the same.

In code.rar
1: test code working fine . there is no flicker
code4: complete code flicker is there. since might i am calling repeatedly in main loop
122  Using Arduino / Programming Questions / Re: Call a function from main once @ time on: March 01, 2014, 02:45:26 am
I can't help feeling that we have been here before.
Use method 2 but only write to the LCD when something displayed on it has changed.

Ya the problem as told earlier i could not able to find solution. Please share some example to understand.
my question is as you know i 2 code  one is main and test code. In test code similar thing i am doing but i am not getting any flickering , i can change menu etc. if same code being pasted in main code with all other function being used. here flicker will occur.
What makes the code to flicker.
You are keep saying write to the LCD when something displayed on it has changed. this will work fine in my test code ?? why it is not working in my main code.
if you saying i am wrong . which function i am doing wrong. Give some example code so i can understand better instead of saying below statement repeatedly.
write to the LCD when something displayed on it has changed.
123  Using Arduino / Programming Questions / Re: Call a function from main once @ time on: March 01, 2014, 02:02:20 am
I don't know how to do that. give example program.
I have similar program working fine without any other function being called. But When i use these function along with my main code it start flickering.
124  Using Arduino / Programming Questions / Call a function from main once @ time on: March 01, 2014, 12:15:39 am
Dear all,

I have code attached here. I wanted to call a function named LCD_CALL from loop function. If this function being called other function below should  be executed.
here LCD call function : used to display parameter and set parameter.

I tried these thing:
1) The flickering of LCD has stopped, but delayed my press button execution  by 1000ms
Code:
void loop()
{
LCD_CALL();
delay(1000);
}
2) it continuously flicker LCD. because i am calling lcd_call without delay.time frame are not matching
Code:
void loop()
{LCD_CALL();
}

3) i put condition it working fine. but problem here  not allow to set parameter.

Code:
void loop()
{
 int button;
  while(( button = read_LCD_buttons()) != btnNONE)
  {
    lcd_call();
  }
  //wdt_reset();
  delay(500);
}



125  Using Arduino / Programming Questions / Concenate integer values has string on: February 28, 2014, 06:24:50 am
Dear all.
i would like to know is it possible to concanate the integer value as complete string
i have 4 parameter
a=1;
b=2;
c=3;
d=4;
String s1=(char*)(a+b+c+d);
if yes how can we do it

expected output:
"1234"
126  Using Arduino / Programming Questions / kEY SELECTION ISSUE: on: February 28, 2014, 04:15:46 am
Dear all,
I have below key configuration.
key selection
Quote
RIGHT->   MENU SELECTION /OK
LEFT-> EXIT
UP->INCREMENT
DOWN ->DECREMENT
SELECT-> RESET

LCD_CALL IS MY FUNCTION
Quote
MENU_OPTION 1: DISPLAY PARAMETER
MENU_OPTION 2: SET PARAMETER
MENU_OPTION 3: EXIT

KEY USED:
RIGHT KEY : CHANGE THE MENU

DISPLAY PARAMETER
Code:
1- DATE & TIME
2- COORDINATE
3-WINDSPEED
4-DESIRED ANGLE
5-EXIT
KEY USED:
[b]UP: INCREMENT DISPLAY SCREEN
DOWN: DECREMENT DISPLAY SCREEN
RIGHT : BACK  TO MENU

 [/b]
When i enter case 2: i couldn't able to exit.like in Display function.let me know how to solve this issue
SET_PARAMETER
Code:
1-  SET DATE & TIME
2- SET COORDINATE
3-SET START TIME
4-SET STOP TIME
5-EXIT
KEY USED :
[b]UP:INCREMENT
DOWN:DECREMENT
RIGHT: OK
LEFT:EXIT
[/b]
circuit diagram available here:

www.freetronics.com/pages/16x2-lcd-shield-quickstart-guide#.UxBSvs7peg


code is pasted here
1) code:  http://paste.ubuntu.com/7009386/
2) set perameter functions      :http://paste.ubuntu.com/7009428/
127  Using Arduino / Programming Questions / Re: While loop exit condition on: February 27, 2014, 05:21:29 am
I checked Serial monitor window . The if button left is pressed loop stop executing . but never goes out of loop & get hang.
If right button pressed get out of loop. but next time when display window selected going to display previous state of display

Code:
while(button1 != btnLEFT)
128  Using Arduino / Programming Questions / Re: While loop exit condition on: February 27, 2014, 04:39:13 am
pseudo code:
Code:
MENU:
button=read_button();
MENU OPTION=4;
MENU_COUNTER=1
if (button==RIGHT)
{
INCREMENT    MENU_COUNTER;
}
CHECK (MENU_COUNTER<MENU OPTION)

IF MENU_COUNTER ==1
     CALL DISPLAY ();
IF MENU_COUNTER==2
 CALL SET_FUNCTION();

ELSE
   EXIT MENU DISPLAY & DISPLAY DATE AND TIME;MENU_COUNTER=1;

CALL DISPLAY()
     [b]   LABEL1:[/b]BUTTON=read_button();
       IF( BUTTON==UP)
            INCREMENT   DISPLAY_COUNTER;
       IF( BUTTON==DOWN)
           DECREMENT   DISPLAY_COUNTER;
       IF(BUTTON==LEFT)
            EXIT TO MENU
       IF (BUTTON==RIGHT)
           EXIT TO SET PERAMETER
    SWITCH( DISPLAY_COUNTER)
                   [b] 1: DATE AND TIME DISPLAY
                    2: COORDINATE
                    3:WINDSPEED
                    4:DESIRED ANGLE
                    5:EXIT FROM SWITCH FUNCTION[/b]
                   GOTO [b]LABEL1:[/b]
         

CALL SET_FUNCTION();
    [b]   LABEL2:[/b]BUTTON=read_button();
      F( BUTTON==UP)
            INCREMENT   SET_COUNTER;
       IF( BUTTON==DOWN)
           DECREMENT   SET_COUNTER;
       IF(BUTTON==LEFT)
            EXIT TO MENU
       SWITCH( DISPLAY_COUNTER)
                   [b] 1: SET DATE AND TIME DISPLAY;   INCREMENT   SET_COUNTER;
                    2: SET COORDINATE;   INCREMENT   SET_COUNTER;
                    3:SET START TIME & STOP TIME;   INCREMENT   SET_COUNTER;
                    4:EXIT FROM SWITCH FUNCTION[/b]
                   GOTO [b]LABE2:[/b]



129  Using Arduino / Programming Questions / Re: While loop exit condition on: February 27, 2014, 03:03:23 am
Somehow they are one & same. Problem here is how get exit of while loop and go back to Menu slection or Next case.


http://paste.ubuntu.com/7004020/
130  Using Arduino / Programming Questions / Re: While loop exit condition on: February 27, 2014, 02:26:20 am
That code does not compile making it difficult/impossible to help.

Here i code modify. Here From Display function not exiting.

Code:
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
#define btnRIGHT  0 // Okay
#define btnUP     1 // inc
#define btnDOWN   2 // dec
#define btnLEFT   3 // Select
#define btnSELECT 4 // Menu
#define btnNONE   5
#define beeper A1      // Alarm buzzer
#define shortBeep 100
#define longBeep  500
int adc_key_in = 0;
int menuOptions = 5;
int Display_counter=0;
int DS_Counter=0;
int counter;
int button1=1;
void setup()
{
  Serial.begin(9600);
}

void loop()
{
  lcd_call();

}

void lcd_call()
{
  int button = 0;
  int menuOption = 1;
  lcd.begin(16,2);
  lcd.setCursor(0,0);
  lcd.print("MENU DISPLAY:");
  while (menuOption <= menuOptions)
  {
    button = read_LCD_buttons();
    if (button == btnRIGHT)
    {
      timedBeep(shortBeep,1);  
      menuOption++;
      switch(menuOption)
      {
      case 2:
        lcd.begin(16,2);
        lcd.setCursor(0,0);
        lcd.print("Display");
        //button1= read_LCD_buttons();
        while((button1 = read_LCD_buttons()) != btnLEFT)
        {
          button1= read_LCD_buttons();
          DS_Counter=Display_selection();
          switch(DS_Counter)
          {
          case 1:
            lcd.setCursor(0,0);
            digitalClockDisplay();
            timedBeep(shortBeep,1);
            break;
          case 2:
            lcd.setCursor(0,0);
            Display_angle();
            timedBeep(shortBeep,1);
            break;
          case 3:
            lcd.setCursor(0,0);
            Display_coordinate();
            timedBeep(shortBeep,1);  menuOption=2;
            break;
          case 4:
            lcd.setCursor(0,0);
            Display_Wind();
            timedBeep(shortBeep,1); menuOption=2;
            break;
          case 5:  menuOption=2;
            break;    
          }
           //button1= read_LCD_buttons();
           if((button1 = read_LCD_buttons() == btnRIGHT)||(button1 = read_LCD_buttons() == btnLEFT))
           {
           menuOption=3;break;
           }
            menuOption=3;
        }                
       break;
      case 3:Serial.println("Setperameter");
        lcd.begin(16,2);
        lcd.setCursor(0,0);
        lcd.print("Set perameter:");
        delay(1000);
        break;
      case 4:Serial.println("Exit fun");
        lcd.begin(16,2);
        lcd.setCursor(0,0);
        lcd.print("EXIT:");
        break;
      }
    }
  }
}  


int read_LCD_buttons()
{
  adc_key_in = analogRead(0);      // read the value from the sensor
  // my buttons when read are centered at these valies: 0, 131, 307, 481, 722
  // we add approx 50 to those values and check to see if we are close
  // No button pressed should be 1023
  if (adc_key_in > 1000) return btnNONE; // We make this the 1st option for speed reasons since it will be the most likely result
  if (adc_key_in < 50)   return btnRIGHT;
  if (adc_key_in < 195)  return btnUP;
  if (adc_key_in < 380)  return btnDOWN;
  if (adc_key_in < 555)  return btnLEFT;
  if (adc_key_in < 790)  return btnSELECT;  
  // return btnNONE;  // when all others fail, return this...

}

void timedBeep(int beepTime, int beepCount)
{
  for (int i = 0; i < beepCount; i ++)
  {
    digitalWrite(beeper, HIGH);
    delay(beepTime);
    digitalWrite(beeper, LOW);
    delay(beepTime);
  }
}
void digitalClockDisplay()
{ lcdClear();
  lcd.print("date");
  lcd.print("    ");

}
void Display_angle()
{ lcdClear();
  lcd.print("angle:");
  lcd.print(45.0); lcd.print("    ");
}
void Display_coordinate()
{ lcdClear();
  lcd.print("coordinate");
  lcd.print(13.04); lcd.print("    ");
}
void Display_Wind()
{ lcdClear();
  lcd.print("wind speed");
  lcd.print(30.0); lcd.print("    ");
}

int Select_section()

{
  int button = read_LCD_buttons();
  if(button==btnUP)
    counter++;
  if(button==btnDOWN)
    counter--;
  if(counter>6)
  {
    counter=0;
  }
  return(counter);
}

int Display_selection()
{
  int button = read_LCD_buttons();

  if(button==btnUP)
    Display_counter++;
  if(button==btnDOWN)
    Display_counter--;

  if(Display_counter>=5)
  {
    Display_counter=0;
  }
  return(Display_counter);

}

void lcdClear(){
  lcd.clear();
  lcd.begin(16,2);
  lcd.setCursor(0,0);
}


131  Using Arduino / Programming Questions / Re: While loop exit condition on: February 26, 2014, 11:33:20 pm
i could not able to change menu:
In order to go from Display to set_parameter  i need to enter display parameter first and then enter to the Set parameter.

When I enter into Set parameter  some time directly goes to longitude.or remain in same thing even longitude is SET




Code:
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

#define btnRIGHT  0 // Okay
#define btnUP     1 // inc
#define btnDOWN   2 // dec
#define btnLEFT   3 // Select
#define btnSELECT 4 // Menu
#define btnNONE   5
#define beeper A1      // Alarm buzzer
#define shortBeep 100
#define longBeep  500

void setup()
{
Serial.begin(9600);
}
void loop()
{
LCD_MENU();
}
void LCD_MENU()
{

int button = 0;
  menuOption = 1;
  lcdClear();
  lcd.print("MENU DISPLAY:");

  while (menuOption <= menuOptions)
  {

    button = read_LCD_buttons();
    if (button == btnRIGHT)
    {
      timedBeep(shortBeep,1);   
      menuOption++;
  }else
  {
    menuOption;
  }
switch(menuOption)
      {
      case 2:  lcdClear();lcd.print("DISPLAY:");
        while((button = read_LCD_buttons()) != btnLEFT)
        {
          Serial.println(button);
          DS_Counter=Display_selection();
          switch(DS_Counter)
          {
          case 1:lcd.setCursor(0,0);digitalClockDisplay(); timedBeep(shortBeep,1); break;
          case 2: lcd.setCursor(0,0);Display_angle(); timedBeep(shortBeep,1); break;
          case 3:lcd.setCursor(0,0);Display_coordinate(); timedBeep(shortBeep,1); break;
          case 4:lcd.setCursor(0,0); Display_Wind(); timedBeep(shortBeep,1);break;
           case 5: break;   
          }
          button = read_LCD_buttons();
          //menuOption++;                       
        }

      case 3:
        lcdClear();
        lcd.print("SET PARAMETER");
while(Set_Counter<5)
        {         
          Set_Counter=Select_section();
   switch(Set_Counter)
          {
   case 1:setDateTime();timedBeep(shortBeep,1);break;
           case 2:set_latitude();timedBeep(shortBeep,1);break;
           case 3:set_longitude() ; timedBeep(shortBeep,1);break;
           case 4:set_trackertime();timedBeep(shortBeep,1);break;
           case 5:break;             
          }

          Set_Counter=Select_section(); 
          menuOption++;     
        }
        break;

      case 4:
        lcd.begin(16,2);
        lcd.setCursor(0,0);
        lcd.print("EXIT WINDOW");
        break;


      }
    }





}
int read_LCD_buttons()
{
  adc_key_in = analogRead(0);      // read the value from the sensor
  // my buttons when read are centered at these valies: 0, 131, 307, 481, 722
  // we add approx 50 to those values and check to see if we are close
  // No button pressed should be 1023
  if (adc_key_in > 1000) return btnNONE; // We make this the 1st option for speed reasons since it will be the most likely result
  if (adc_key_in < 50)   return btnRIGHT;
  if (adc_key_in < 195)  return btnUP;
  if (adc_key_in < 380)  return btnDOWN;
  if (adc_key_in < 555)  return btnLEFT;
  if (adc_key_in < 790)  return btnSELECT; 
  // return btnNONE;  // when all others fail, return this...

}
void digitalClockDisplay()
{
lcd.print("date");

}
void Display_angle()
{
lcd.print("angle:");
lcd.print(45.0)
}
void Display_coordinate()
{
lcd.print("coordinate");
lcd.print(13.04);
}
void Display_Wind()
{
lcd.print("wind speed");
lcd.print(30.0);
}

float set_latitude()
{


  float lastlatitude_degree=latitude;

  //lastlatitude_degree=latitude;

  if (lastlatitude_degree>0.0 && lastlatitude_degree<99.00)
  {
    latitude=Get_Degree_set("Latitude_degree", lastlatitude_degree, 99.00);
    timedBeep(shortBeep,5);
  }
  else
  {
    timerCancelled("");     
  } 


  Serial.print("Latitude set:");
  Serial.print(latitude);
  return(latitude);
}   

float Get_Degree_set(char timerText[], float startNum, float  maxCount)
{

  float  Degree = startNum;
  int button = 0;
  lcdClear();
  lcd.print(timerText);
  lcd.setCursor(0,1);
  lcd.print(Degree);   

  while (button != btnSELECT)
  {
    button = read_LCD_buttons();

    if(button==btnUP)
    {
      timedBeep(shortBeep,3);
      Degree=Degree+0.2;
    }
    else
      if(button==btnDOWN)
      {
        timedBeep(shortBeep,3);
        Degree=Degree-0.2;
      } 

    if (button == btnRIGHT)
    {
      timedBeep(shortBeep,1);
      return Degree;
    }
    lcd.setCursor(0,1);
    lcd.print(Degree);
    lcd.print("   ");
  }

  return 0;



}
float set_longitude()
{
  float lastlongitude_deg=60.0;
  //lastlongitude_deg= longitude;
  if (lastlongitude_deg>0.00 && lastlongitude_deg<99.00)
  {
    longitude=Get_Degree_set("Longitude_degree:", lastlongitude_deg,99.00);
    timedBeep(shortBeep,20);

  }
  else
  {
    timerCancelled("");     
  }
  Serial.print("Longitude set:");
  Serial.print(longitude);   
  return(longitude);

}

void setDateTime()
 {
 // int button = 0;
 lcdClear();
 lcd.print("DATE-TIME");
 //get month
 mm = getTimerMinutes("Set Month", lastMonth, 12);
 if (mm > 0 && mm < 13)
 {
 //get day
 // default day and hour settings on set date/time
 dd = getTimerMinutes("Set Day", lastDay, 31);
 if (dd > 0 && dd < 32)
 {
 //get year
 yy = getTimerMinutes("Set Year", lastYear, 2999);
 if (yy > 2000 && yy < 3000)
 {
 //get hour
 int thisHour = lastHour;
 // default day and hour settings on set date/time
 h = getTimerMinutes("Set Hour", thisHour, 23);
 if (h >= 0 && h < 24)
 {
 //get minutes
 m = getTimerMinutes("Set Minute", lastMinute, 59);
 if (m < 60)
 {
 // RTC.adjust(DateTime(setYear,setMonth,setDay,setHour,setMinute)); // for DS1307
 //setTime(setHour, setMinute, 0, setDay, setMonth, setYear); // sec, min, hour, date, month, year
 // rtcSetup();
 //rtcWrite();
 
 lcd.setCursor(0,0);
 lcd.print("Saving...     ");
 delay(1000);
 
 return;       
 }
 else
 {
 timerCancelled("");
 return; 
 } 
 }
 else
 {
 timerCancelled("");     
 }   
 }     
 else
 {
 timerCancelled("");       
 }
 }
 else
 {
 timerCancelled("");     
 }   
 }     
 else
 {
 timerCancelled("");       
 }
 
 }

int getTimerMinutes(char timerText[], int startNum, int maxCount)
{
  int minutes = startNum;
  int button = 0;
  lcdClear();
  lcd.print(timerText);
  lcd.setCursor(0,1);
  lcd.print(minutes);   

  while (button != btnSELECT)
  {
    button = read_LCD_buttons();
    //Serial.println(button);

    if (button == btnLEFT)
    {
      if ((minutes + 10) <= maxCount)
      {
        timedBeep(shortBeep,1);
        minutes = minutes + 10;
      }
      else
      {
        timedBeep(shortBeep,2);
      }
    }

    if (button == btnUP)
    {
      if (minutes < maxCount)
      {
        timedBeep(shortBeep,1);
        minutes++;
      }
      else
      {
        timedBeep(shortBeep,2);
        minutes = 0;
      }
    }
    if (button == btnDOWN)
    {
      if (minutes > 0)
      {
        timedBeep(shortBeep,1);
        minutes--;
      }
      else
      {
        timedBeep(shortBeep,2);
        minutes = maxCount;
      }   
    }
    if (button == btnRIGHT)
    {
      timedBeep(shortBeep,1);
      return minutes;
    }
    lcd.setCursor(0,1);
    lcd.print(minutes);
    lcd.print("   ");
  }
  return 0;
}


132  Using Arduino / Programming Questions / Re: While loop exit condition on: February 26, 2014, 09:01:56 am
Time to post the whole of your current code then.


Code is Here , Where i am putting all together
Code:

void lcd_call()
{
  int button = 0;
  menuOption = 1;
  lcdClear();
  lcd.print("MENU DISPLAY:");

  while (menuOption <= menuOptions)
  {

    button = read_LCD_buttons();
    if (button == btnRIGHT)
    {
      //timedBeep(shortBeep,1);  
      menuOption++;
      if (menuOption == 2)
      {
        lcdClear();
        lcd.print("DISPLAY:");  
        button = read_LCD_buttons();


        while((button = read_LCD_buttons()) != btnLEFT)
        {
          Serial.println(button);
          DS_Counter=Display_selection();
          switch(DS_Counter)
          {
          case 1:  
            lcd.setCursor(0,0);
            digitalClockDisplay();
            timedBeep(shortBeep,1);  
            break;
          case 2:
            lcd.setCursor(0,0);
            Display_angle();
            timedBeep(shortBeep,1);
            break;
          case 3:
            lcd.setCursor(0,0);
            Display_coordinate();
            timedBeep(shortBeep,1);
            break;
          case 4:
            lcd.setCursor(0,0);
            Display_Wind();
            timedBeep(shortBeep,1);
            break;
          case 5:
            break;  
          }
          Serial.println(button);                          
        }

        menuOption++;


      }
      if (menuOption == 3)
      {
        int button1;
        lcdClear();
        lcd.print("SET PARAMETER");
        button1 = read_LCD_buttons();
        while(Set_Counter<5)
        {
          Serial.println(button1);
          Set_Counter=Select_section();

          switch(Set_Counter)
          {
          case 1:          
            if(button1 ==btnRIGHT)
            {
              Set_Counter++;
              //Set_flag=1;
            }
            else
            {
              lcd.setCursor(0,0);
              setDateTime();
              timedBeep(shortBeep,1);
              button1 = read_LCD_buttons();
            }
            break;
          case 2:
            lcd.setCursor(0,0);
            set_latitude();
            timedBeep(shortBeep,1);




          case 3:
            lcd.setCursor(0,0);
            set_longitude() ;
            timedBeep(shortBeep,1);
            Set_Counter+1;
            break;
          case 4:
            lcd.setCursor(0,0);
            set_trackertime();
            timedBeep(shortBeep,1);
            Set_Counter+1;
            break;
          case 5:
            break;  
          }
          Serial.println(button1);
          Set_Counter=Select_section();  
          //Set_flag=0;        
        }
        // menuOption++;
      }
      if(menuOption == 4)
      {
        lcdClear();
        lcd.print("EXIT WINDOW");
      }  
    }
  }
}

133  Using Arduino / Programming Questions / Re: While loop exit condition on: February 26, 2014, 08:46:28 am
Updated Code running. with Display section working fine , but could not able to enter the Set perameter menu from Begining. Every time i need to enter the display parameter and then enter into set parameter function  .


Code:



void lcd_call()
{
  int button = 0;
  menuOption = 1;
  lcdClear();
  lcd.print("MENU DISPLAY:");

  while (menuOption <= menuOptions)
  {

    button = read_LCD_buttons();
    if (button == btnRIGHT)
    {
      //timedBeep(shortBeep,1);   
      menuOption++;
      if (menuOption == 2)
      {
        lcdClear();
        lcd.print("DISPLAY:"); 
        button = read_LCD_buttons();


        while((button = read_LCD_buttons()) != btnLEFT)
        {
          Serial.println(button);
          DS_Counter=Display_selection();
          switch(DS_Counter)
          {
          case 1: 
            lcd.setCursor(0,0);
            digitalClockDisplay();
            timedBeep(shortBeep,1); 
            break;
          case 2:
            lcd.setCursor(0,0);
            Display_angle();
            timedBeep(shortBeep,1);
            break;
          case 3:
            lcd.setCursor(0,0);
            Display_coordinate();
            timedBeep(shortBeep,1);
            break;
          case 4:
            lcd.setCursor(0,0);
            Display_Wind();
            timedBeep(shortBeep,1);
            break;
          case 5:
            break;   
          }
          Serial.println(button);                         
        }

        menuOption++;


      }
      if (menuOption == 3)
      {
        int button1;
        lcdClear();
        lcd.print("SET PARAMETER");
        button1 = read_LCD_buttons();
        while(Set_Counter<5)
        {
          Serial.println(button1);
          Set_Counter=Select_section();

          switch(Set_Counter)
          {
          case 1:           
            if(button1 ==btnRIGHT)
            {
              Set_Counter++;
              //Set_flag=1;
            }
            else
            {
              lcd.setCursor(0,0);
              setDateTime();
              timedBeep(shortBeep,1);
              button1 = read_LCD_buttons();
            }
            break;
          case 2:
            lcd.setCursor(0,0);
            set_latitude();
            timedBeep(shortBeep,1);




          case 3:
            lcd.setCursor(0,0);
            set_longitude() ;
            timedBeep(shortBeep,1);
            Set_Counter+1;
            break;
          case 4:
            lcd.setCursor(0,0);
            set_trackertime();
            timedBeep(shortBeep,1);
            Set_Counter+1;
            break;
          case 5:
            break;   
          }
          Serial.println(button1);
          Set_Counter=Select_section(); 
          //Set_flag=0;       
        }
        // menuOption++;
      }
      if(menuOption == 4)
      {
        lcdClear();
        lcd.print("EXIT WINDOW");
      }   
    }
  }



}






134  Using Arduino / Programming Questions / Re: While loop exit condition on: February 26, 2014, 08:42:52 am
The question Here is In while loop how to check condition so that it comes out of loop, so i changed the function .If button is not equal to left i.e true SO it executing switch cases. suppose i pressed left key it has to go out of loop AND  execute .out loop functions. But in my code initially it not executing.
Code:
while(button != btnLEFT)
{
  button = read_LCD_buttons();
..........Switch cases:............
  //code to be executed while the left button is not pressed goes here
}
..........out loop functions.................


Now in Same code i am facing problem on changing Menu selection before entering Display function if press right key it is not going to Set parameter function:
Every time i need to Enter in to Display function and goes to set parameter , What is wrong i am doing
135  Using Arduino / Programming Questions / Re: While loop exit condition on: February 26, 2014, 08:20:56 am
Code:
        while((button = read_LCD_buttons()) != btnLEFT)
Did you mean to put 2 statements in the while condition like that ?  What condition(s) are you testing for exactly ?
In my opinion it is much clearer to read the button state in one statement and then test its value in a second statement.


Initially i tried with (button !=btnLEFT) it didn't worked, but above statement worked for me. Now I am facing problem entering into Setperameter window and changing option in same code
Pages: 1 ... 7 8 [9] 10 11 ... 40