Ticket #69 (new defect)

Opened 7 months ago

Last modified 4 months ago

Problem setting different speeds using Stepper Motors

Reported by: cleon Owned by:
Priority: major Milestone: Firmware 2.0
Component: firmware Keywords: Stepper,Spped
Cc:

Description

Hello,

I have a Make controller kit and I'm using 2 step motors to make my robot following a black/white line. Everything was tested with mchelper without any problems. Problem is when I in C I try to set each engine at different speeds. Example: Stepper 0 at 10 and Stepper 1 at 30. I send in attachment an example. Is it possible to send OSC commands via C language? If so how? Plus, should I use the Sleep(value) after each stepper instruction? So it can execute each stepper instruction before next one?

Thank you very much for your time. Regards, Cleon

Attachments

example.c (1.6 KB) - added by cleon 7 months ago.
Simple program to set different speeds for each stepper motor at the same time

Change History

Changed 7 months ago by cleon

Simple program to set different speeds for each stepper motor at the same time

Changed 4 months ago by liamMT

Hi - I know this was posted a long time ago, but here goes.

I noticed you're not sleeping anywhere in your main loop. This will definitely affect the timing of your code, steppers included. This isn't a surefire fix, but I would definitely recommend adding a Sleep(1) to the bottom of your loop.

Second, calling SetActive?() over and over is generally not a good idea either as it's doing memory allocations, etc. which are very costly and turn off interrupts, which drive the Stepper system. I would recommend only setting it active once at the top of your loop.

If you're still working on this project, I would give those a shot!

Note: See TracTickets for help on using tickets.