Steppig with an arduino timer interrupt is ridiculously simple just using a
simple squarewave
Just set steps to the number of steps to move and it will go.

#define TIMER_DELAY 80
volatile long steps = 0;
void setup()
{
  // Initialize the digital pin as an output.
  // Pin 13 has an LED connected on most Arduino boards
  pinMode(ledPin, OUTPUT);
  pinMode(stepPin, OUTPUT);
  pinMode(dirPin, OUTPUT);
  Timer1.initialize(TIMER_DELAY); // set a timer of length in microseconds
(or 0.1 sec - or 10Hz)
  Timer1.attachInterrupt( timerIsr ); // attach the service routine here
    // Status LED initially on.
   digitalWrite(ledPin, HIGH);
}

/// --------------------------
/// Custom ISR Timer Routine
/// --------------------------
void timerIsr()
{
    // Toggle LED
  if(steps){
      digitalWrite( ledPin, digitalRead( ledPin ) ^ 1 );
      state = state ^ 1;
      digitalWrite( stepPin, state );
      steps--;
  }
}

Rod Webster
*1300 896 832*
+61 435 765 611
Vehicle Modifications Network
www.vehiclemods.net.au


On Thu, 11 May 2023 at 21:53, andy pugh <bodge...@gmail.com> wrote:

> On Thu, 11 May 2023 at 12:45, gene heskett <ghesk...@shentel.net> wrote:
>
> > So I need to hack up in hal. or maybe python, something that could take
> > a true or false signal and issue the correct steps/dir to position the
> > motor in one of two positions.
>
> What two positions? Do do what?
>
> The latest version of the carousel.comp can output stephen position
> commands based on selected pocket.
> But might be overkill for what you need, or might also be inadequate.
>
> --
> atp
> "A motorcycle is a bicycle with a pandemonium attachment and is
> designed for the especial use of mechanical geniuses, daredevils and
> lunatics."
> — George Fitch, Atlanta Constitution Newspaper, 1912
>
>
> _______________________________________________
> Emc-developers mailing list
> Emc-developers@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/emc-developers
>

_______________________________________________
Emc-developers mailing list
Emc-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-developers

Reply via email to