correct code

It would be possible to tell me if this code this right, because I’m still beginner.
thank you.

#include “Wire.h”
#include <Stepper.h>

const int stepsPerRevolution = 200;
Stepper myStepper(stepsPerRevolution, 8,9,10,11);

#include “I2Cdev.h”
#include “MPU6050.h”

MPU6050 accelgyro;

int16_t ax, ay, az;
int16_t gx, gy, gz;

int gyrox;
int gyrox0;
float gyroratex;
float gyroanglex;
int xAcc;
int zero;
int xangle;
int realx;
float filterAngle;
float filterTerm0;
float filterTerm1;
float filterTerm2;
float timeConstant =0.966;
float dt = 0.02;

int motor1a = 8;
int motor1b = 9;
int motor2a = 10;
int motor2b = 11;

#define LED_PIN 13
bool blinkState = false;

void setup() {

Wire.begin();
Serial.begin(38400);
myStepper.setSpeed(60);
gyrox0 = analogRead(4);
zero = analogRead(5);
delay(100);

}

void loop() {
gyrox0 = analogRead(4);
xAcc = analogRead(5);
gyroratex = (analogRead(4)- gyrox0)/0.22;
gyroanglex = gyroanglex + gyroratex dt;
xangle = (analogRead(5)- zero)
(3.3/1023)/0.21;
realx = asin(xangle) * 57.2957795;
filterTerm0 = (realx - filterAngle) * timeConstant *timeConstant;
filterTerm2 += filterTerm0 *dt;
filterTerm1 = filterTerm2 + ((realx-filterAngle) 2 timeConstant)+ gyroratex;
filterAngle +(filterTerm1 *dt)+ filterAngle;

delay (10);

if (filterAngle >= 45)
myStepper.step(stepsPerRevolution);
delay (500);
gyrox0 = analogRead(4);
zero = analogRead(5);
delay (10);

if (filterAngle >= -45)
myStepper.step(-stepsPerRevolution);
delay(500);
gyrox0 = analogRead(4);
zero = analogRead(5);
delay (10);

}

What did the compiler say?
What did your tests tell you?

Remember to post code using code tags, please.

#include "Wire.h"
#include <Stepper.h>

const int stepsPerRevolution = 200; 
Stepper myStepper(stepsPerRevolution, 8,9,10,11); 

#include "I2Cdev.h"
#include "MPU6050.h"

MPU6050 accelgyro;

int16_t ax, ay, az;
int16_t gx, gy, gz;

int gyrox;
int gyrox0;
float gyroratex;
float gyroanglex;
int xAcc;
int zero;
int xangle;
int realx;
float filterAngle;
float filterTerm0;
float filterTerm1;
float filterTerm2;
float timeConstant =0.966;
float dt = 0.02;

int motor1a = 8;
int motor1b = 9;
int motor2a = 10;
int motor2b = 11;

#define LED_PIN 13
bool blinkState = false;

void setup() 
{
  Wire.begin();
  Serial.begin(38400);
  myStepper.setSpeed(60);
  gyrox0 = analogRead(4);
  zero = analogRead(5);
  delay(100);
}

void loop() 
{
  gyrox0 = analogRead(4);
  xAcc = analogRead(5);
  gyroratex = (analogRead(4)- gyrox0)/0.22;
  gyroanglex = gyroanglex + gyroratex *dt;
  xangle = (analogRead(5)- zero)*(3.3/1023)/0.21;
  realx = asin(xangle) * 57.2957795;
  filterTerm0 = (realx - filterAngle) * timeConstant *timeConstant;
  filterTerm2 += filterTerm0 *dt;
  filterTerm1 = filterTerm2 + ((realx-filterAngle) *2* timeConstant)+ gyroratex;
  filterAngle +(filterTerm1 *dt)+ filterAngle;
   
  delay (10);
   
  if (filterAngle >= 45)
    myStepper.step(stepsPerRevolution);
  delay (500);
  gyrox0 = analogRead(4);
  zero = analogRead(5);
  delay (10);
     
  if (filterAngle >= -45)
    myStepper.step(-stepsPerRevolution);
  delay(500);
  gyrox0 = analogRead(4);
  zero = analogRead(5);
  delay (10);
}

ok

THOMAZ: ok

What's that supposed to mean?

Not the build error, however the stepper motors do not work. That there will be error in the command code to the engines.

Do the stepper motors work with simple example code?

Do you know the forum Portuguese section?

OK