![]() ![]() Originally I had a robot arm dropping the slide holders (6x9cm) into a box, but they would fall at an angle and jam so that the robot arm would eventually try to push into the heap of metal slide holders sticking out of the box - not good. If both are blocked, the platform needs to be lowered, if both are clear the platform needs to be raised. Two light-sensitive resistors get light on them from LEDs - the top path should be clear and the bottom blocked. The slides are ~1.5mm thick, so after each one is dropped the platform is lowered. The project using this code runs on an Arduino Uno and attempts to maintain the height of a platform on which metal slide holders are dropped. > Thank you both, I would appreciate if you can share your code James :) I pulled info from here:įrom that I adapted code that I will be happy to share, if anyone is interested. The setup decides the frequency of interrupts. I guess with more stepper motors there would be more lines similar to that one. The interrupt handler I need has just this: ![]() If nothing needs to be done at a particular call, the interrupt handler will return sooner. The obvious point is to call the run() function more often than needed, by putting it into interrupt handler and making that fires more often, so that you don't miss pulses (as Mike covered). And its so much easier to handle the stepper motors separately from other polling-style events. I understand that its not guaranteed and there may be subtleties that more complex code will expose, but I think that if the interrupt code is kept as brief as possible, the chances for mischief are small. I use this library on an interrupt handler, arduino Uno, no problems. I will be using either 1 or 2 steppers that will be doing heavy physical work, and will be close to their limits in terms of speed and torque, as well as this there will be a need for low vibration and shock, so it's quite important that the timings are reliable and accurate. I'm happy for the interrupt to be taking 75%+ of the CPU time, as the light text processing is neither time consuming or time sensitive.Įven better, it would potentially be possible to look deeper into other workings of the library, and tell the interrupt to fire off at exactly the right time, though I'm not sure how complex this would be to do. What I'd like is to offload the call to n() to a timed interrupt such that I can ignore it from the body of my code, has any one tried this? Are there any references or examples that are available? I'm confident that it wouldn't be hard to do, I just can't help but think that there must be a gotcha in there somewhere. I could use trial and error to determine how far apart in the code such calls can be, but this all feels a little cluttered and inefficient. Unfortunately things get a little more complex when data is found on the serial port as all of the code to process such events must be filled with frequent calls to n() to avoid skipping steps. I've just started writing pseudo code, and the code effectively checks the serial port then runs n() time about. Most instructions will be to move to a location, followed by progress report every few hundred ms, there will be no high frequency short moves happening. I'd like to write something that basically boils down to a custom g-code interpreter, my needs are not too complex so it will be massively cut down relative to the likes of GRBL etc, but it will be custom enough that I do want to do it myself. I'm completely new to using the library, but am very impressed so far. I've been lurking on here for a while, and have searched for references to this, but see nothing that looks relevant. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |