Programming Stepper Motor

Hi everybody

Could any body help me with this code please
could you just check if it is working?

I have written this program to drive a stepper motor 57HS22 and Current sensor ACS712 with Voltage divider, And RPM sensor E18-D80NK
and Arduino Uno connected with H-bridge L298 to drive stepper

They are all connected to alternator Ginlong GL-PMG 1500

My main purpose is the stepper motor to move 7 steps each step 2 degrees at the blades angle (that means from 14 degree to 0 at the blades)
At each step the stepper reads the current and the voltage then calculates the power and also read the rpm each second for one minute (means 60 reading for one min) then take the average of the power and the rpm. After that move to the next step (which is 12 degree at the blades angle) and repeat the same process.
After reading the 7 averages move back to the step associated with the highest power (I will take the rpm for the data only)
Then repeat this process of searching for the highest power each 5 min.

This the code

#include <Stepper.h>

const float DEGREE =  1.8;
const int StepsPerRevolution = 1;
//gear ratio 1:2
float steps = 0.5; // half degree = 0.9 // step number = 10
float anglelimit = 5*DEGREE;//9degrees
float next;

Stepper myStepper(StepsPerRevolution, 8,9,10,11);  

float Voltage;
float Current;
float Power = 0.0;
float maxPower = 0.0;
float RPM;
float VoltageDivider;
float CurrentSensor;
float RPMSensor;

int i = 0;
int index;
int maxposition;
float total = 0;
float averages[8];
int pot;

void setup()

myStepper.setSpeed(1 * 60);


void loop(){
myStepper.step(-1 * steps * (14- 2*maxposition));


void  scanpositions()
for(  index = 0; index <8; index++)
pot = analogRead(3);+

for(i=1; i<=60; i++)
  VoltageDivider = analogRead(4);
  CurrentSensor = analogRead (5);
  RPMSensor = analogRead (6);
  Voltage = VoltageDivider * 70 / 3.8;
  Current = CurrentSensor * 30 / 5;
  Power = Current * Voltage + Power;
  RPM = RPMSensor;
averages[index] = Power / 60;  //average power  

  if (maxPower <  averages[index]){
    maxPower = Power;
    maxposition = index;
myStepper.step(steps*next); //next position

 // power = 0 

Could anybody help me if there is mistakes in the code?

This is part of the project in your other Thread.

Could anybody help me if there is mistakes in the code?

Tell us first whether it does what you want, and if it does not, please tell us what it actually does and what it should do.

I couldn't even tell if there are mistakes in my own code without trying it.