Two actuators

Hello,
I am trying to have a joystick operate two linear actuators, with pots for feedback.
I admit I am having trouble understanding C++, however I have had it running one actuator so far.

I have a L298N dual bridge shield, used without PWM.

When I verify my new sketch I have an error with " getdestination" which worked ok in the original sketch.

Please tell me where I am going wrong.

Ant.

//Hopefully two motors together


const int sact = A0; // Steering actuator pot
const int tact = A1; // Throttle actuator pot
const int spot = A2; // Steering joystick
const int tpot = A3; // Throttle joystick
const int enablef = 7; // Digital out, forward 
const int enableb = 8; // Digital out, reverse 
const int enablel = 12; //Digital out, left
const int enabler = 13; // digital out, right

int sactMax = 1023; //
int sactMin = 0; //  position of steering actuator
int spotMax = 1023;
int spotMin =0; // position of steering joystick
int tactMax = 1023; //
int tactMin = 0;//  position of throttle actuator
int tpotMax = 1023;
int tpotMin = 0; // position of throttle joystick

int precision = 2; // how close to the final value to get
int checkingInterval = 50; // How often position is checked in milliseconds

int rawcurrentposition = 0;
int currentposition = 0;
int rawdestination = 0;
int destination = 0;
int difference = 0; // values for knowing location of steering
int rawcurrentposition2 = 0;
int currentposition2 = 0;
int rawdestination2 = 0;
int destination2 = 0;
int difference2 = 0; // values for knowing location of throttle
void setup()
{
  pinMode(sact, INPUT); // feedback from steering actuator
  pinMode(tact, INPUT); // feedback from throttle actuator
  pinMode(spot, INPUT); // input from steering joystick
  pinMode(tpot, INPUT); // input from throttle joystick
  pinMode(enablef, OUTPUT); // High for forward, low for reverse
  pinMode(enableb, OUTPUT); // High for reverse, high for forward
  pinMode(enablel, OUTPUT); // High for left, low for right, default low
  pinMode(enabler, OUTPUT); // High for right, low for left, default low
  Serial.begin(9600);

}

  void loop()
{

  destination = getdestination();
  currentposition = analogRead(sact); // check where steering actuator is
  currentposition = analogRead(sact); // check where steering actuator is
 
  Serial.print("Position of steering actuator is    ");
  Serial.println(analogRead(sact));
  delay(20);
  
  currentposition2 = analogRead(tact); // check where throttle actuator is
  currentposition2 = analogRead(tact);
   
  Serial.print("Position of throttle actuator is     ");
  Serial.println(analogRead(tact));
  delay(20);
  difference = destination - currentposition; //
  if (currentposition > destination)pullactuator(destination);
  else if (currentposition < destination)pushactuator(destination);
  else if (difference < precision && difference > -precision) stopactuator();
delay(10);
{
  difference2 = destination2 - currentposition2;//
  if (currentposition2 > destination2)pullactuator2(destination2);
  else if (difference2 < precision && difference2 > -precision) stopactuator2();
} // end void loop

int getdestination() 
{
  rawdestination = analogRead(spot); // read steering joystick
  destination = map(rawdestination, spotMin,spotMax,sactMin,sactMax);
  return(destination);
}  // end get destination

int getdestination2()
{
  rawdestination2 = analogRead(tpot); // read thrott joystick
  destination2= map(rawdestination2, tpotMin, tpotMax,tactMin, tactMax);

  return(destination2);
}
void pushactuator(int destination)
{
  destination = getdestination();
  int temp = analogRead(sact);
  difference = destination - temp;
  delay(10);
       temp = analogRead(tact);
       difference2 = destination2 - temp;

  while (difference > precision || difference <- precision, difference2 > precision2 || difference2<-precision2
  
  {
    destination = getdestination();
    temp = analogRead(sact);
    delay(10)
    temp = analogRead(tact);
    difference = destination - temp; difference2 = destination2 - temp;
  } // end while

  delay (25);
  stopactuator();


}  //end stopactuator

  void pullactuator(int destination)
  {
    destination = getdestination();
    int temp = analogRead(sact);
    delay(10);
    difference = destination - temp;

    while (difference > precision || difference < -precision)
    {
      destination = getdestination();
      temp = analogRead(sact);
      delay(10);
      difference = destination - temp;
      pullactuator();
    } // end while
    
    delay(25);
    stopactuator();
  }  

void stopactuator()
{
  digitalWrite(enablef, LOW);
  digitalWrite(enableb, LOW);
 
} // end stop actuator

void stopactuator2()
{
   digitalWrite(enablel, LOW);
  digitalWrite(enabler, LOW);
}


void pushactuator() //  forward, 
{
  digitalWrite(enablef, HIGH);
  digitalWrite(enableb, LOW);
  
} // end push

void pushactuator2() // left
{
  digitalWrite(enablel, HIGH);
  digitalWrite(enabler, LOW);
} //end push2

void pullactuator() // backwards, 
{
  digitalWrite(enableb,HIGH);
  digitalWrite(enablef,LOW);
 
} // end pull

void pullactuator2() //right
{
   digitalWrite(enabler, HIGH);
  digitalWrite(enablel, LOW);
}  // end pull2

What was the error? Cut and paste.

Sorry still learning.

Arduino: 1.6.13 (Windows 10), Board: "Arduino/Genuino Uno"

C:\Users\Antony\Documents\Arduino\dual_shield\dual_shield.ino: In function 'void loop()':

dual_shield:52: error: 'getdestination' was not declared in this scope

destination = getdestination();

^

dual_shield:67: error: 'pullactuator' was not declared in this scope

if (currentposition > destination)pullactuator(destination);

^

dual_shield:68: error: 'pushactuator' was not declared in this scope

else if (currentposition < destination)pushactuator(destination);

^

dual_shield:69: error: 'stopactuator' was not declared in this scope

else if (difference < precision && difference > -precision) stopactuator();

^

dual_shield:73: error: 'pullactuator2' was not declared in this scope

if (currentposition2 > destination2)pullactuator2(destination2);

^

dual_shield:74: error: 'stopactuator2' was not declared in this scope

else if (difference2 < precision && difference2 > -precision) stopactuator2();

^

C:\Users\Antony\Documents\Arduino\dual_shield\dual_shield.ino:81:21: warning: return-statement with a value, in function returning 'void' [-fpermissive]

return(destination);

^

dual_shield:85: error: a function-definition is not allowed here before '{' token

{

^

dual_shield:92: error: a function-definition is not allowed here before '{' token

{

^

dual_shield:174: error: expected '}' at end of input

} // end pull2

^

exit status 1
'getdestination' was not declared in this scope

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

There are a multiple issues. The easiest one is you're missing a closing curly brace around line 77.

In addition to that though, there are a bunch of functions which are being called incorrectly, undeclared variables and syntax errors.

As I said, I am struggling with C++.

Being told there are errors is great, however knowing faults are there does not help me to understand the problem.

Thanks for taking the time to read my post.
Regards, Ant.

delay(10);
{

in loop(), what is that brace doing there?

ant0001:
Being told there are errors is great, however knowing faults are there does not help me to understand the problem.

This is where a little proactivity is necessary. I agree that the curly brace issue can be a pain in the butt to work out but fix that then the error messages are quite self explanatory. Even if you have to work through them one by one, you should get a much better understanding if you can fix them yourself.