Announcement

Collapse
No announcement yet.

4d Display controling a stepper motor

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • 4d Display controling a stepper motor

    Hello,

    I am working on a project where I have a 43PT display controlling a stepper motor through an arduino. I was wondering if anyone could give me some arduino programing tips so when the slider on the display is moved the stepper motor rotates.

    Thanks

  • #2
    do you already have your arduino sketch setup to do exactly how you say? ex. can you control the rotation of your servo without the lcd? if yes then it can be controlled easily via slider. just need to know your slider rotation values/degrees?"/positions? set that up and post it here and we could see whats possible

    Comment


    • #3
      Right now my arduino program is just rotating the stepper back and forth. The problem I am having is try to write the program so the stepper motor is moving off of what the slider is doing.



      #include <genieArduino.h>
      #include <Stepper.h>

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

      // initialize the stepper library on the motor shield
      Stepper myStepper(stepsPerRevolution, 12,13);

      // give the motor control pins names:
      const int pwmA = 3;
      const int pwmB = 11;
      const int brakeA = 9;
      const int brakeB = 8;
      const int dirA = 12;
      const int dirB = 13;

      int x = 0;
      void setup() {
      Serial.begin(9600);
      // set the PWM and brake pins so that the direction pins // can be used to control the motor:
      pinMode(pwmA, OUTPUT);
      pinMode(pwmB, OUTPUT);
      pinMode(brakeA, OUTPUT);
      pinMode(brakeB, OUTPUT);
      digitalWrite(pwmA, HIGH);
      digitalWrite(pwmB, HIGH);
      digitalWrite(brakeA, LOW);
      digitalWrite(brakeB, LOW);




      // initialize the serial port:
      Serial.begin(9600);
      // set the motor speed (for multiple steps only):
      myStepper.setSpeed(50);
      }


      void loop() {


      myStepper.step(100);
      myStepper.step(-100);

      delay(1000);

      }

      Comment


      • #4
        well your part way there jacob, there is no feedback so you'd have to keep track of your steps. now you have 100 steps per revolution, correct, and you want the slider to position the stepper at the position mark, correct? you need to keep track of the steps in order to do that first,

        Comment

        Working...
        X