Please help to determine issues with code

i am using this code to go to subroutines.

Enter_data_point_a and Enter_data_point a using a push button.

within the subroutines i am using a pot in order to change the value displayed using another subroutine called, pot_time_display

i am having problems using the code and i am fairly new.

/*

  The circuit:
 * LCD RS pin to digital pin 12
 * LCD Enable pin to digital pin 11
 * LCD D4 pin to digital pin 5
 * LCD D5 pin to digital pin 4
 * LCD D6 pin to digital pin 3
 * LCD D7 pin to digital pin 2
 * LCD R/W pin to ground
 * 10K resistor:
 * ends to +5V and ground
 * wiper to LCD VO pin (pin 3)
 * Pot to Analo

 */

// include the library code:
#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

int sensorPin = A0;    // select the input pin for the potentiometer
int sensorValue = 0;  // variable to store the value coming from the sensor


void setup() {

  lcd.begin(16, 2);                                 // set up the LCD's number of columns and rows: 
  
  lcd.setCursor(4, 0);                              // Set the cursor to Column 4, Row 0
  lcd.print("Welcome");                             // Print "Welcome"
  
  lcd.setCursor(0,1);                               // Set the cursor to Column 0, Row 1
  lcd.print("Auto FollowFocus");                    // Print "Auto Follow Focus"
  delay(4000);                                      // Delay
  lcd.clear();                                      // Clear Screen
  
  lcd.setCursor(2, 0);                              // set the cursor to column 2, line 0
  lcd.print("Created by");                          // Print "Created By"
  
  lcd.setCursor(4, 1);                              // set the cursor to column 4, line 1
  lcd.print("Amarjit");                             // Print "Amarjit"
  delay(2000);                                      // Delay
  lcd.clear();                                      // Clear Screen
  
}

void loop()

}
  void enter_point_a_data();
  
  digitalWrite(8, HIGH);                            // set the LED on
  
  lcd.setCursor(0, 0);                              // set the cursor to column 0, line 0
  lcd.print("Enter Data for");                      // Print "Enter Data for"
  lcd.setCursor(4, 1);                              // set the cursor to column 4, line 1
  lcd.print("Point A");                             // Print "Point A"
  delay(3000);                                      // Delay
  lcd.clear();                                      // Clear Screen
  
  lcd.setCursor(1, 0);                              // set the cursor to column 1, line 0 
  lcd.print("Time & Speed");                        // Print "Time & Speed"
  lcd.setCursor(5, 1);                              // set the cursor to column 5, line 1
  lcd.print("Min");                                 // Print "Min"
  lcd.setCursor(12, 1);                             // set the cursor to column 12, line 1
  lcd.print("Deg");                                 // Print "Deg"
  lcd.setCursor(14,0);                              // set the cursor to column 14, line 0
  lcd.print("A");                                   //Print "A"
  
  lcd.setCursor(0, 1);                              // set the cursor to column 0, line 1
  sensorValue = analogRead(sensorPin);              // read the value from the sensor
  pot_time_display (analogRead (sensorPin));        //***************************************************GO TO pot_time_display SUBROUTINE***********************************
  
  if (digitalRead(7) == HIGH)                       // if button is pressed 
    {                                               
      enter_point_b_data();                         // then go to sub routine
    }                          
}
  void enter_point_b_data()
{
  while(1)
  {
 
  digitalWrite(8, HIGH);   // set the LED on

  
  lcd.setCursor(0, 0);                              // set the cursor to column 0, line 0
  lcd.print("Enter Data for");                      // Print "Enter Data for"
  lcd.setCursor(4, 1);                              // set the cursor to column 4, line 1
  lcd.print("Point B");                             // Print "Point B"
  delay(3000);                                      // Delay
  lcd.clear();                                      // Clear Screen
  
  lcd.setCursor(1, 0);                              // set the cursor to column 1, line 0 
  lcd.print("Time & Speed");                        // Print "Time & Speed"
  lcd.setCursor(5, 1);                              // set the cursor to column 5, line 1
  lcd.print("Min");                                 // Print "Min"
  lcd.setCursor(12, 1);                             // set the cursor to column 12, line 1
  lcd.print("Deg");                                 // Print "Deg"
  
  lcd.setCursor(14,0);                              // set the cursor to column 14, line 0
  lcd.print("B");                                   //Print "A"
  
  lcd.setCursor(0, 1);                              // set the cursor to column 0, line 1
  sensorValue = analogRead(sensorPin);              // read the value from the sensor
  pot_time_display (analogRead (sensorPin));        //***************************************************GO TO pot_time_display SUBROUTINE***********************************
 }
  
}

void pot_time_display (int SensorValue)
{
  switch(sensorValue)
   {
    case '=0'               :lcd.print("0.00");break;
    case '>= 1, < 17.05'    :lcd.print("0.10");break;
    case '>=17.05, < 34.1'  :lcd.print("0.20");break;
    case '>=34.1,  < 51.15' :lcd.print("0.30");break;
    case '>=51.15, < 68.2'  :lcd.print("0.40");break;
    case '>=68.2,  < 85.25' :lcd.print("0.50");break;
    case '>=85.25, < 102.3' :lcd.print("1.00");break;
    
    case '>=102.3, < 119.35':lcd.print("1.00");break;
    case '>=119.35,< 136.4' :lcd.print("1.10");break;
    case '>=136.4, < 153.45':lcd.print("1.20");break;
    case '>=153.45,< 170.5' :lcd.print("1.30");break;
    case '>=170.5, < 187.55':lcd.print("1.40");break;
    case '>=187.55,< 204.6' :lcd.print("1.50");break;
    case '>=204.6, < 221.65':lcd.print("2.00");break;
    
    case '>=221.65,< 238.7' :lcd.print("2.00");break;
    case '>=238.7, < 255.75':lcd.print("2.10");break;
    case '>=255.75,< 272.8' :lcd.print("2.20");break;
    case '>=272.8, < 289.85':lcd.print("2.30");break;
    case '>=289.85,< 306.9' :lcd.print("2.40");break;
    case '>=306.9, < 323.95':lcd.print("2.50");break;
    case '>=323.95,< 341'   :lcd.print("3.00");break;
    
   } 
  
}
{

enter_point_a_data();                                // go to sub routine

{

Problems like this one?

void loop()

}

It is best to say what kind of "problems" you have - it doesn't compile? It doesn't load? It doesn't do what I expected? It does what I expected, but in ways I hadn't intended?

Someone very recently posted code like this:

case '=0'               :

And I told them that whilst it was perfectly valid C, it would not and could not be made to do what they wanted.

yes

hullait1: yes

Yes? Yes what? Which of those?

it doesn't compile? It doesn't load? It doesn't do what I expected? It does what I expected, but in ways I hadn't intended?

Someone very recently posted code like this: Code:

case '=0' :

And I told them that whilst it was perfectly valid C, it would not and could not be made to do what they wanted.

Found it: http://arduino.cc/forum/index.php/topic,67548.msg496553.html#msg496553

i understand that and have been looking into it.

i believe i need to use the map function.. is that correct?

however i am trying to get the subroutines to work atm and am not being successful.

the program doesnt compile.

the program doesnt compile.

Look at some example code.

Can you find any that looks like this :

void loop()

}

This is a bit odd too:

}
{ // <--- what is this opening?

enter_point_a_data();

{ // <--- or this
void enter_point_b_data()

Looks to me to be a bit of a black-hole.

}
{ // <— what is this opening?

enter_point_a_data();

{ // <— or this

they should go to the subroutine enter_point_a_data sub routine i would of thought.

black hole

im not quite sure what u mean

Quote black hole

im not quite sure what u mean

You go in, but you never come out. Maybe that's what you intended.

they should go to the subroutine enter_point_a_data sub routine i would of thought.

But they're orphaned - outside of any function. Any "{" must have a closing "}"

does this code look more realistic…

/*

  The circuit:
 * LCD RS pin to digital pin 12
 * LCD Enable pin to digital pin 11
 * LCD D4 pin to digital pin 5
 * LCD D5 pin to digital pin 4
 * LCD D6 pin to digital pin 3
 * LCD D7 pin to digital pin 2
 * LCD R/W pin to ground
 * 10K resistor:
 * ends to +5V and ground
 * wiper to LCD VO pin (pin 3)
 * Pot to Analo

 */

// include the library code:
#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

int sensorPin = A0;    // select the input pin for the potentiometer
int sensorValue = 0;  // variable to store the value coming from the sensor


void setup() {

  lcd.begin(16, 2);                                 // set up the LCD's number of columns and rows: 
  
  lcd.setCursor(4, 0);                              // Set the cursor to Column 4, Row 0
  lcd.print("Welcome");                             // Print "Welcome"
  
  lcd.setCursor(0,1);                               // Set the cursor to Column 0, Row 1
  lcd.print("Auto FollowFocus");                    // Print "Auto Follow Focus"
  delay(4000);                                      // Delay
  lcd.clear();                                      // Clear Screen
  
  lcd.setCursor(2, 0);                              // set the cursor to column 2, line 0
  lcd.print("Created by");                          // Print "Created By"
  
  lcd.setCursor(4, 1);                              // set the cursor to column 4, line 1
  lcd.print("Amarjit");                             // Print "Amarjit"
  delay(2000);                                      // Delay
  lcd.clear();                                      // Clear Screen
  
}

void loop()

enter_point_a_data();                                // go to sub routine

  void enter_point_a_data();
  
  digitalWrite(8, HIGH);                            // set the LED on
  
  lcd.setCursor(0, 0);                              // set the cursor to column 0, line 0
  lcd.print("Enter Data for");                      // Print "Enter Data for"
  lcd.setCursor(4, 1);                              // set the cursor to column 4, line 1
  lcd.print("Point A");                             // Print "Point A"
  delay(3000);                                      // Delay
  lcd.clear();                                      // Clear Screen
  
  lcd.setCursor(1, 0);                              // set the cursor to column 1, line 0 
  lcd.print("Time & Speed");                        // Print "Time & Speed"
  lcd.setCursor(5, 1);                              // set the cursor to column 5, line 1
  lcd.print("Min");                                 // Print "Min"
  lcd.setCursor(12, 1);                             // set the cursor to column 12, line 1
  lcd.print("Deg");                                 // Print "Deg"
  lcd.setCursor(14,0);                              // set the cursor to column 14, line 0
  lcd.print("A");                                   //Print "A"
  
  lcd.setCursor(0, 1);                              // set the cursor to column 0, line 1
  sensorValue = analogRead(sensorPin);              // read the value from the sensor
  pot_time_display (analogRead (sensorPin));        //***************************************************GO TO pot_time_display SUBROUTINE***********************************
  
  if (digitalRead(7) == HIGH)                       // if button is pressed 
    {                                               
      enter_point_b_data();                         // then go to sub routine
    }                          
}
  void enter_point_b_data()
{
  while(1)
  {
 
  digitalWrite(8, HIGH);   // set the LED on

  
  lcd.setCursor(0, 0);                              // set the cursor to column 0, line 0
  lcd.print("Enter Data for");                      // Print "Enter Data for"
  lcd.setCursor(4, 1);                              // set the cursor to column 4, line 1
  lcd.print("Point B");                             // Print "Point B"
  delay(3000);                                      // Delay
  lcd.clear();                                      // Clear Screen
  
  lcd.setCursor(1, 0);                              // set the cursor to column 1, line 0 
  lcd.print("Time & Speed");                        // Print "Time & Speed"
  lcd.setCursor(5, 1);                              // set the cursor to column 5, line 1
  lcd.print("Min");                                 // Print "Min"
  lcd.setCursor(12, 1);                             // set the cursor to column 12, line 1
  lcd.print("Deg");                                 // Print "Deg"
  
  lcd.setCursor(14,0);                              // set the cursor to column 14, line 0
  lcd.print("B");                                   //Print "A"
  
  lcd.setCursor(0, 1);                              // set the cursor to column 0, line 1
  sensorValue = analogRead(sensorPin);              // read the value from the sensor
  pot_time_display (analogRead (sensorPin));        //***************************************************GO TO pot_time_display SUBROUTINE***********************************
 }
}
  
  }
  void pot_time_display (int SensorValue)
  {
    switch(sensorValue)
     {
      case '=0'               :lcd.print("0.00");break;
      case '>= 1, < 17.05'    :lcd.print("0.10");break;
      case '>=17.05, < 34.1'  :lcd.print("0.20");break;
      case '>=34.1,  < 51.15' :lcd.print("0.30");break;
      case '>=51.15, < 68.2'  :lcd.print("0.40");break;
      case '>=68.2,  < 85.25' :lcd.print("0.50");break;
      case '>=85.25, < 102.3' :lcd.print("1.00");break;
      
      case '>=102.3, < 119.35':lcd.print("1.00");break;
      case '>=119.35,< 136.4' :lcd.print("1.10");break;
      case '>=136.4, < 153.45':lcd.print("1.20");break;
      case '>=153.45,< 170.5' :lcd.print("1.30");break;
      case '>=170.5, < 187.55':lcd.print("1.40");break;
      case '>=187.55,< 204.6' :lcd.print("1.50");break;
      case '>=204.6, < 221.65':lcd.print("2.00");break;
      
      case '>=221.65,< 238.7' :lcd.print("2.00");break;
      case '>=238.7, < 255.75':lcd.print("2.10");break;
      case '>=255.75,< 272.8' :lcd.print("2.20");break;
      case '>=272.8, < 289.85':lcd.print("2.30");break;
      case '>=289.85,< 306.9' :lcd.print("2.40");break;
      case '>=306.9, < 323.95':lcd.print("2.50");break;
      case '>=323.95,< 341'   :lcd.print("3.00");break; 
     } 
  }


enter_point_a_data();                                // go to sub routine

You need to be more careful with your opening and closing braces { and }. They really matter - they're not just for appearance.

void loop()

enter_point_a_data();

Should be

void loop()
{
  enter_point_a_data();
  // do other stuff
}

You've got all sorts of places where you have stray closing braces, missing opening braces, etc.

Every opening brace needs a closing brace, and every closing brace needs an opening brace. No exceptions.

when compiling it says..

enter_point_a_data();

was not declared in the scope what does this mean??

does this code look more realistic..

Why are you asking us? What does the compiler say?

it says

enter_point_a_data();

not defined in the scope what does this mean?

It means that the compiler cannot find a meaningful object called "enter_point_a_data(); " at the point where it is used.

Have a look at some of the example code. Is there any that looks like this:

void loop()

enter_point_a_data();

?

what do i need to do in order to address the issue

Work through, and understand some of the example code.

Declare a function called " enter_point_a_data()" Pay attention to ensuring that you have as many "{" as you have "}", and that they are in the correct places.

Your code has a number of issues. Try backing off a bit for now: get rid of enter_point_a_data() and all references to it. Just make loop do something simple, get it to compile and work. Then work on adding the extra functionality.