Triggering an LED Matrix with Stepper Motors

Hey everyone,

So I've been trying to work out how to control messages on an LED Matrix with the number of steps my stepper motor makes. So different messages would be triggered to appear at different step points, for example:

if steps = 20
display message 1

I was wondering if anyone had any guidance or advise on how to do this as I've found that doing this in if statements doesn't work?

Alex

if(steps == 20)
{
  -- code to display mesage --
}
1 Like

Hey thanks for the tip!

I've been trying to test with this logic but have found it to be more complicated than I thought it would be. I'm wondering if I need to create a variable like this:

int steps;

void loop {
  if(steps == 20)
{
 myDisplay.displayText("Scrolling text", PA_CENTER, 100, 0, PA_SCROLL_LEFT, PA_SCROLL_LEFT); 
}
}

However I realise that I haven't assigned it to a function which can keep track of steps - any advice on how to do this would be appreciated! Im still quite new to working with physical computing

Its up to you to track the number of steps! Just increment or decrement a variable in you function thst steps the motor.

Thanks, that works now - I completely forgot about incrementing variables, my code now works as I need it to thanks

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.