// Stepper motor on Wokwi!

#include <Stepper.h>

const int stepsPerRevolution = 200;  // change this to fit the number of steps per revolution
// for your motor

// initialize the stepper library on pins 8 through 11:
Stepper myStepper(stepsPerRevolution, 8, 9, 10, 11);

void setup() {
  // set the speed at 60 rpm:
  myStepper.setSpeed(60);
  // initialize the serial port:
  Serial.begin(9600);
}

void loop() {
  // step one revolution  in one direction:
 
 int desired = analogRead(A0);
int d = map(desired,0,1023,70,215);
 
 int actual = analogRead(A1);
 int a = map(actual,0,1023,70,215);
 int diff=d-a;

 
  Serial.print("desired sp ");
Serial.println(d,DEC);
   Serial.print("actual ");
Serial.println(a,DEC);
Serial.print("diff);
Serial.println(diff,DEC);
int percent =map(diff,0,215,0,100)
if(d > a){
Serial.print("heating ");
Serial.println(percent,DEC);

}
 
 
  myStepper.step(stepsPerRevolution);
  delay(500);

  // step one revolution in the other direction:
  //Serial.println("counterclockwise");
  myStepper.step(-stepsPerRevolution);
  delay(500);
}