Expected numeric before constant error

hi im trying to code my stepper motors with servo and i get the error expected numeric before constant heres my code

#include<Servo.h>

Servo myservo;

#define stepper1_pin 4
#define stepper2_pin 5
#define stepper3_pin 6
#define stepper4_pin 7

#define stepper5_pin 8
#define stepper6_pin 9
#define stepper7_pin 10
#define stepper8_pin 11

void setup() {
// put your setup code here, to run once:
pinMode(stepper1_pin 4,OUTPUT);
pinMode(stepper2_pin 5,OUTPUT);
pinMode(stepper3_pin 6,OUTPUT);
pinMode(stepper4_pin 7,OUTPUT);

pinMode(stepper5_pin 8,OUTPUT);
pinMode(stepper6_pin 9,OUTPUT);
pinMode(stepper7_pin 10,OUTPUT);
pinMode(stepper8_pin 11,OUTPUT);
myservo.attach(2);

}

void loop() {
// put your main code here, to run repeatedly:
digitalWrite(stepper1_pin 4, HIGH);
digitalWrite(stepper2_pin 5, LOW);
digitalWrite(stepper3_pin 6, HIGH);
digitalWrite(stepper4_pin 7, LOW);
myservo.write(90);
delay(2000);

digitalWrite(stepper5_pin 8, LOW);
digitalWrite(stepper6_pin 9, HIGH);
digitalWrite(stepper7_pin 10, LOW);
digitalWrite(stepper8_pin 11, HIGH);
myservo.write(90);
delay(2000);

digitalWrite(stepper1_pin 4, HIGH);
digitalWrite(stepper2_pin 5, LOW);
digitalWrite(stepper3_pin 6, LOW);
digitalWrite(stepper4_pin 7, HIGH);
myservo.write(90);
delay(2000);

digitalWrite(stepper5_pin 8, LOW);
digitalWrite(stepper6_pin 9, HIGH);
digitalWrite(stepper7_pin 10, HIGH);
digitalWrite(stepper8_pin 11, LOW);
myservo.write(90);
delay(3000);

}

can some help me

Welcome to the forum

Please follow the advice given in the link below when posting code, in particular the section entitled 'Posting code and common code problems'

Use code tags (the </> icon above the compose window) to make it easier to read and copy for examination

  digitalWrite(stepper8_pin 11, LOW);

Check the syntax of the digitalWrite() function

What values are you trying to call it with ?

You probably mean

  pinMode(stepper8_pin, OUTPUT);

The pre-processor will replace stepper8_pin with 11 when the code is compiled because of your #define

#define stepper8_pin 11

yes thank you your right it worked now thanks

Do you understand what was wrong ?

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.