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
{