Sign In

Temperature Controller

purushotham purushotambapatla@gmail.com Malaysia

Hardware: Arduino Uno Software: Arduino Prugrammmable Ide

hello, i have problem when i set values in setpoint by pressing switch 1,but im unabel to go to set mode how to write program togo to set mode i donot know pls help here is the code

Images

Program

#include <LiquidCrystal.h>
LiquidCrystal lcd(2,4,8,9,10,11);

int inc = 6;
int dec = 7;

int switch1=3;
int switch2=5;

int intialstate1;
int finalstate1;

int intialstate2;
int finalstate2;

int count = 0;
int count1 = 0;
int count2 = 0;
int count3 = 0;
int potpin=A0;
int readValue;
unsigned int v;
void setup() {
 lcd.begin(16,2);
 lcd.setCursor(0,0);
 lcd.print("ADC ; ");
  pinMode(switch1,INPUT);
 pinMode(switch2,INPUT);
 pinMode(potpin,INPUT);
 //lcd.setCursor(0,1);
 //lcd.print(count);
 

  
  

}

void loop()
{
  lcd.setCursor(0,0);
  lcd.print("VMSK Technology");
  delay(5000);
  lcd.clear();
  lcd.setCursor(0,0);
  lcd.print ("ADC :");
  while(1)
  {
      readValue = analogRead(potpin)/2.5575;
      lcd.setCursor(4, 0);
      lcd.print(readValue);
      
 xyz: lcd.setCursor(5,1);
      lcd.print(count3);
      lcd.setCursor(6,1);
      lcd.print(count2);
      lcd.setCursor(7,1);
      lcd.print(count1);
      lcd.setCursor(8,1);
      lcd.print(count);
      delay(2000);
   if(digitalRead(switch1) == HIGH)       //set mode
      {   
         delay(5000);
         lcd.clear();
         readValue = analogRead(potpin)/2.5575;
         lcd.setCursor(4, 0);
         lcd.print(readValue);
        // lcd.setCursor(7,1);
         //lcd.print(on4);
         delay(2000);
      
      
          while(1)
          {
               if(digitalRead(switch2)==HIGH) //setcursor
                 {
                    v++;
                    delay(300);
                    if(v >= 4) v=0; 
                 }   
     
      
      
     if (v==0)
      {
            lcd.setCursor(8,1);
            lcd.blink();
          //increment Part   
            finalstate1 = digitalRead(inc);
            if(finalstate1 != intialstate1)
            {
                  delay(10);
                  finalstate1 = digitalRead(inc);
                      {
                        if(finalstate1 == HIGH)
                        {
                          
                              count++;
                              if(count>=10)
                               {
                                  count=0;
                               }
                              lcd.clear();
                           lcd.setCursor(0,0);
                           
                           lcd.print("ADC ; ");
                             lcd.setCursor(8,1);
                          
                           lcd.print(count);                       
                           }
                          intialstate1 = finalstate1;
                      }
              }
          // decrement part
          
          finalstate2 = digitalRead(dec);
            if(finalstate2 != intialstate2)
              {
                      delay(10);
                      finalstate2 = digitalRead(dec);
                      {
                                    if(finalstate2 == HIGH)
                                    {
                                      
                                            count--;
                                            if(count>=10)
                                            {
                                              count=9;
                                            }
                                            lcd.clear();
                                         lcd.setCursor(0,0);
                                         
                                         lcd.print("ADC ; ");
                                         lcd.setCursor(8,1);
                                         
                                         lcd.print(count);                       
                                  }
                                  intialstate2 = finalstate2;
                      }
                }
                 if(digitalRead(switch1)==HIGH)
                {
                  goto xyz;
                }
            }
            
             if (v==1)
      {
            lcd.setCursor(7,1);
          //increment Part   
            finalstate1 = digitalRead(inc);
            if(finalstate1 != intialstate1)
            {
                  delay(10);
                  finalstate1 = digitalRead(inc);
                      {
                        if(finalstate1 == HIGH)
                        {
                          
                              count1++;
                              if(count1>=10)
                              {
                                count1=0;
                              }
                              lcd.clear();
                           lcd.setCursor(0,0);
                           
                           lcd.print("ADC ; ");
                             lcd.setCursor(7,1);
                          
                           lcd.print(count1);                       
                           }
                          intialstate1 = finalstate1;
                      }
              }
          // decrement part
          
          finalstate2 = digitalRead(dec);
            if(finalstate2 != intialstate2)
              {
                      delay(10);
                      finalstate2 = digitalRead(dec);
                      {
                                    if(finalstate2 == HIGH)
                                    {
                                      
                                            count1--;
                                            if(count1>=10)
                                            {
                                              count1=9;
                                            }
                                            lcd.clear();
                                         lcd.setCursor(0,0);
                                         
                                         lcd.print("ADC ; ");
                                         lcd.setCursor(7,1);
                                         
                                         lcd.print(count1);                       
                                  }
                                  intialstate2 = finalstate2;
                      }
                }
                 if(digitalRead(switch1)==HIGH)
                {
                  goto xyz;
                }
            }
                  if (v==2)
      {
            lcd.setCursor(6,1);
          //increment Part   
            finalstate1 = digitalRead(inc);
            if(finalstate1 != intialstate1)
            {
                  delay(10);
                  finalstate1 = digitalRead(inc);
                      {
                        if(finalstate1 == HIGH)
                        {
                          
                              count2++;
                              if(count2>=10)
                              {
                                count2=0;
                              }
                              lcd.clear();
                           lcd.setCursor(0,0);
                           
                           lcd.print("ADC ; ");
                             lcd.setCursor(6,1);
                          
                           lcd.print(count2);                       
                           }
                          intialstate1 = finalstate1;
                      }
              }
          // decrement part
          
          finalstate2 = digitalRead(dec);
            if(finalstate2 != intialstate2)
              {
                      delay(10);
                      finalstate2 = digitalRead(dec);
                      {
                                    if(finalstate2 == HIGH)
                                    {
                                      
                                            count2--;
                                            if(count2>=10)
                                            {
                                              count2=9;
                                            }
                                            lcd.clear();
                                         lcd.setCursor(0,0);
                                         
                                         lcd.print("ADC ; ");
                                         lcd.setCursor(6,1);
                                         
                                         lcd.print(count2);                       
                                  }
                                  intialstate2 = finalstate2;
                      }
                }
                 if(digitalRead(switch1)==HIGH)
                {
                  goto xyz;
                }
            }
            
                  if (v==3)
      {
            lcd.setCursor(5,1);
          //increment Part   
            finalstate1 = digitalRead(inc);
            if(finalstate1 != intialstate1)
            {
                  delay(10);
                  finalstate1 = digitalRead(inc);
                      {
                        if(finalstate1 == HIGH)
                        {
                          
                              count3++;
                              if(count3>=10)
                              {
                                count3=0;
                              }
                              lcd.clear();
                           lcd.setCursor(0,0);
                           
                           lcd.print("ADC ; ");
                             lcd.setCursor(5,1);
                          
                           lcd.print(count3);                       
                           }
                          intialstate1 = finalstate1;
                      }
              }
          // decrement part
          
          finalstate2 = digitalRead(dec);
            if(finalstate2 != intialstate2)
              {
                      delay(10);
                      finalstate2 = digitalRead(dec);
                      {
                                    if(finalstate2 == HIGH)
                                    {
                                      
                                            count3--;
                                            if(count3>=10)
                                            {
                                              count3=9;
                                            }
                                            lcd.clear();
                                         lcd.setCursor(0,0);
                                         
                                         lcd.print("ADC ; ");
                                         lcd.setCursor(5,1);
                                         
                                         lcd.print(count3);                       
                                  }
                                  intialstate2 = finalstate2;
                      }
                }
                 if(digitalRead(switch1)==HIGH)
                {
                  goto xyz;
                  
                }
            }
            
        }
    }
  }
  }

Replies

R Avinash Gupta
2016-12-26 04:01:06
What is this set mode?

From where have you copied the code?
R purushotham
2016-12-26 06:29:07
this is my own program , the set mode is when we press switch1 first and when next we press switch 2it will set the cursor position in first digit to set valuesfrom 1to9 utill to 4th digit by pressing 4times,next if we press switch1 theset values are set but,again i want to set values im unabel to adjust the set valuesin set mode,i dont know how to go to writeprogramfor set values adjustment loop pls help ,thank you

Post a reply to purushotham

Think you can help purushotham ? Then post your thoughts that might help purushotham. You will earn a lot of reputation in the technical community.

If your program is in multiple files, then ZIP the entire folder and attach below

Images and Screenshots

These helps other better understand your suggestion.