Looking for simple stepper code

Adafruit Ethernet, Motor, Proto, Wave, Datalogger, GPS Shields - etc!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
koachkletus
 
Posts: 19
Joined: Thu Mar 22, 2012 1:28 am

Looking for simple stepper code

Post by koachkletus »

Okay,,complete newbie,,finally on my 2nd UNO and 3rd motor shield (don't ask,,hah) and have my Uno talking with the shield and talking with my stepper. I verify and up load the Adafruit motor library and all works fine. What I am looking for is simple code to run the motor x amount of steps forward, pause, and run the same amount of steps forward again. I am using the 12 volt 200 step motor from our favorite site (Adafruit), 9v power supply, Uno, and of course the Adafruit motor shield. Anybody care to assist this old man?

User avatar
adafruit_support_bill
 
Posts: 88090
Joined: Sat Feb 07, 2009 10:11 am

Re: Looking for simple stepper code

Post by adafruit_support_bill »

run the motor x amount of steps forward, pause, and run the same amount of steps forward again.
That part of it would be:

Code: Select all

  motor.step(100, FORWARD, SINGLE); 
  delay(1000);  // 1000 milliseconds = 1 second
  motor.step(100, FORWARD, SINGLE); 
You don't mention any other requirements, such as what triggers that sequence and how often it needs to run. If you put that bit of code in the "setup" function, it will run exactly once after each reset.

koachkletus
 
Posts: 19
Joined: Thu Mar 22, 2012 1:28 am

Re: Looking for simple stepper code

Post by koachkletus »

Thank you very much! I'm actually working on a telecine system and it's very much in it's baby steps. I plan on using the motor to advance 8mm/Super8 film and I just wanted to see if the motor would be exact enough for my requirements. I have not decided how I will trigger the motor & camera set up yet. The camera is a simple usb webcam. My idea is to use the motor- advance film x amount of steps - pause - trigger camera - etc. The webcam will be connected via usb to my computer for capture. Also, the webcam had a switch to trigger a single photo which will be my next hurdle. I need to figure out how to trigger the camera during the delay state of the code you sent me. Preferably an electronic switch. Again, thank you for your assistance.

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino Shields from Adafruit”