forward not declared in this scope

tried to combine two previously written codes, a temperature sensor and a pushbutton. I’m still new to this

//TMP36 Pin Variables
int sensorPin = 0; //the analog pin the TMP36's Vout (sense) pin is connected to
                        //the resolution is 10 mV / degree centigrade with a
                        //500 mV offset to allow for negative temperatures

/*
 * setup() - this function runs once when you turn your Arduino on
 * We initialize the serial connection with the computer
 */
 //create 3 global variables
//PWM controls speed
//DIR A and B are the direction logic pins
int PWM = 3; 
int DIRA = 4;
int DIRB = 5;
//create a global boolean variable to toggle
//when button is pressed, set it to true.
boolean state = true;
void setup()
{
  Serial.begin(9600);  //Start the serial connection with the computer
                       //to view the result open the serial monitor 
                        //pinModes for H-Bridge control pins
  pinMode(PWM,OUTPUT);
  pinMode(DIRA,OUTPUT);
  pinMode(DIRB,OUTPUT);
  //set pin 6 to INPUT_PULLUP, no need for a pullup resistor
  pinMode(6,INPUT_PULLUP);
}


void loop()                     // run over and over again

 //create a local varaible thats stores the button state (1 or 0) 
{ int buttonState = digitalRead(6); 
 
 //if buttonState is 0 (less than 1) toggle the state variable to 
 //the opposite of the current state (!state)
 if(buttonState < 1)
 {
  state = !state;
  delay(250);
 
 
 //if state is false drive motor forward, else stop.
 if(state == false)
 {
  forward(250);
 }
 //getting the voltage reading from the temperature sensor
{ int reading = analogRead(sensorPin);  

 // converting that reading to voltage, for 3.3v arduino use 3.3
 float voltage = reading * 5.0;
 voltage /= 1024.0; 

 // print out the voltage
 Serial.print(voltage); Serial.println(" volts");

 // now print out the temperature
 float temperatureC = (voltage - 0.5) * 100 ;  //converting from 10 mv per degree wit 500 mV offset
                                               //to degrees ((voltage - 500mV) times 100)
 Serial.print(temperatureC); Serial.println(" degrees C");

if(temperatureC > 24){
  analogWrite(9, 250);
} else(temperatureC < 24);
 analogWrite(9,0); 

 
delay(1000);                                     //waiting a second
}

//custom function for forward
void forward(int Speed)
{
  digitalWrite(DIRA,250);
  digitalWrite(DIRB,0);
}

//custom function for reverse
void reverse(int Speed)
{
  digitalWrite(DIRA,0);
  digitalWrite(DIRB,250);
}

It looks like you might have an imbalance on the curly braces. might not rectify the whole problem but would look into that first and see what the next compile time error is.

I got it to compile I’m not sure if it will do what you want it to do though, good luck

//TMP36 Pin Variables
int sensorPin = 0; //the analog pin the TMP36's Vout (sense) pin is connected to
                        //the resolution is 10 mV / degree centigrade with a
                        //500 mV offset to allow for negative temperatures

/*
 * setup() - this function runs once when you turn your Arduino on
 * We initialize the serial connection with the computer
 */
 //create 3 global variables
//PWM controls speed
//DIR A and B are the direction logic pins
int PWM = 3; 
int DIRA = 4;
int DIRB = 5;
//create a global boolean variable to toggle
//when button is pressed, set it to true.
boolean state = true;
void setup()
{
  Serial.begin(9600);  //Start the serial connection with the computer
                       //to view the result open the serial monitor 
                        //pinModes for H-Bridge control pins
  pinMode(PWM,OUTPUT);
  pinMode(DIRA,OUTPUT);
  pinMode(DIRB,OUTPUT);
  //set pin 6 to INPUT_PULLUP, no need for a pullup resistor
  pinMode(6,INPUT_PULLUP);
}


void loop(){                     // run over and over again

 //create a local varaible thats stores the button state (1 or 0) 
 int buttonState = digitalRead(6); 
 
 //if buttonState is 0 (less than 1) toggle the state variable to 
 //the opposite of the current state (!state)
 if(buttonState < 1){
  state = !state;
  delay(250);
 
 
 //if state is false drive motor forward, else stop.
 if(state == false){
 int  forward(250);
 }
 //getting the voltage reading from the temperature sensor
 int reading = analogRead(sensorPin);  

 // converting that reading to voltage, for 3.3v arduino use 3.3
 float voltage = reading * 5.0;
 voltage != 1024.0; 

 // print out the voltage
 Serial.print(voltage); Serial.println(" volts");

 // now print out the temperature
 float temperatureC = (voltage - 0.5) * 100 ;  //converting from 10 mv per degree wit 500 mV offset
                                               //to degrees ((voltage - 500mV) times 100)
 Serial.print(temperatureC); Serial.println(" degrees C");

if(temperatureC > 24){
  analogWrite(9, 250);
}
else(temperatureC < 24);{
 analogWrite(9,0); 
 delay(1000); //waiting a second
}

//custom function for forward
void forward(int Speed);{
  digitalWrite(DIRA,250);
  digitalWrite(DIRB,0);
}

//custom function for reverse
void reverse(int Speed);{
  digitalWrite(DIRA,0);
  digitalWrite(DIRB,250);
}
}
}

thank you! this is actually the fritzing that I put together I'm not sure it's right though

and

whats it going to do?

It's going to spin a motor, based on the temperature, and reverse it with the pushbutton because the motor is being used to pull and open a claw, and close with the reverse

@joceline787, you already posted on this issue 4 days ago, with almost exactly the same title. What's wrong with continuing the original thread?
Forward was not declared in this scope

You know that double-posting is not allowed here?

There is a lot of work to be done here so let’s start with the circuit.
I suggest you use the second one and just move the temp sensor over to that one.

I took ZBay’s version of your code and cleaned it up to make it easier to read and moved the forward and reverse functions out of loop().
however it still needs a lot of work yet.

//TMP36 Pin Variables
int sensorPin = 0; //the analog pin the TMP36's Vout (sense) pin is connected to
int PWM = 3;       //PWM controls speed
int DIRA = 4;      //DIR A and B are the direction logic pins
int DIRB = 5;


boolean state = true;  //create a global boolean variable to toggle when button is pressed, set it to true.
                        
void setup()
{
  Serial.begin(9600);        //Start the serial connection with the computer
                             //to view the result open the serial monitor
  pinMode(PWM, OUTPUT);      //pinModes for H-Bridge control pins
  pinMode(DIRA, OUTPUT);
  pinMode(DIRB, OUTPUT);
  pinMode(6, INPUT_PULLUP);  //set pin 6 to INPUT_PULLUP, no need for a pullup resistor
}


void loop()      // run over and over again
{
  int buttonState = digitalRead(6);  //create a local varaible thats stores the button state (1 or 0)

  if (buttonState == 0)         //if buttonState is 0 (less than 1) toggle the state variable to
  {
    state = !state;             //the opposite of the current state (!state)
  }

  if (state == false)         //if state is false drive motor forward, else stop.
  {
    forward(250);
  }

  int reading = analogRead(sensorPin);                       //getting the voltage reading from the temperature sensor

  float voltage = reading * 5.0;                             // converting that reading to voltage, for 3.3v arduino use 3.3
  voltage != 1024.0;
  Serial.print(voltage); Serial.println(" volts");           // print out the voltage

  float temperatureC = (voltage - 0.5) * 100 ;               //converting from 10 mv per degree wit 500 mV offset
                                                             //to degrees ((voltage - 500mV) times 100)
  Serial.print(temperatureC); Serial.println(" degrees C");  // now print out the temperature

  if (temperatureC > 24)
  {
    analogWrite(9, 250);
  }
  else(temperatureC < 24)
  {
    analogWrite(9, 0);
    delay(1000);              //waiting a second
  }
}                             //End of Loop


void forward(int Speed)       //custom function for forward
{
  digitalWrite(DIRA, 250);
  digitalWrite(DIRB, 0);
}


void reverse(int Speed)       //custom function for reverse
{
  digitalWrite(DIRA, 0);
  digitalWrite(DIRB, 250);
}

The following section of code should be calling the reverse function shouldn’t it? If you changed it to if(state == true) it would make more sense wouldn’t it? It would work the same.

if (state == false)         //if state is false drive motor forward, else stop.
  {
    forward(250);
  }

This section should be calling the forward and reverse functions, that’s what they are there for.
Also the ‘else’ should be ‘else if’. and ditch the delay().

 if (temperatureC > 24)
  {
    analogWrite(9, 250);
  }
  else(temperatureC < 24)
  {
    analogWrite(9, 0);
    delay(1000);              //waiting a second
  }

digitalWrite can only be LOW or HIGH(0 or 1 is the same thing) not 250
maybe you meant analogWrite which can use 0-255 but since 250 is so close to full on I would just use digitalWrite.

 digitalWrite(DIRA, 250);

There is more but this should get you started.