Hello I'll start by state that i am very much a newbie but am keen to learn.
What i am trying to do is replicate with the arduino an adjustable 555 timer based circuit that i used to provide pulses to a stepper motor driver and strobe light for an artwork that creates and animation on a spinning disc
The stepper motor driver has 10 micro steps per step and there are 5 steps and one strobe flash per frame. I need a stepping frequency of around 350 hz and a flash frequency of 50 times less.
I thought the best way to achieve this was to use the Timer1 library in the playground, however i can not work out whether it is possible to adjust/change the frequency it runs at everything i try breaks the code.
any help or advice is most welcome
thanks for reading
my code so far
#include "TimerOne.h"
byte x = 0;
void setup()
{
pinMode(13, OUTPUT);
Timer1.initialize(2860); // initialize timer1
Timer1.pwm(9, 512); // setup pwm on pin 9, 50% duty cycle
Timer1.attachInterrupt(callback); // attaches callback() as a timer overflow interrupt
}
void callback()
{
++x;
if (x == 50) { digitalWrite(13, HIGH); x = 0; }
else { digitalWrite(13, LOW); }
}
void loop()
{
}