{"action":"created","issue":{"url":"https://api.github.com/repos/laurb9/StepperDriver/issues/43","repository_url":"https://api.github.com/repos/laurb9/StepperDriver","labels_url":"https://api.github.com/repos/laurb9/StepperDriver/issues/43/labels{/name}","comments_url":"https://api.github.com/repos/laurb9/StepperDriver/issues/43/comments","events_url":"https://api.github.com/repos/laurb9/StepperDriver/issues/43/events","html_url":"https://github.com/laurb9/StepperDriver/issues/43","id":288319974,"node_id":"MDU6SXNzdWUyODgzMTk5NzQ=","number":43,"title":"Non-blocking issue","user":{"login":"RobbinBaauw","id":5289010,"node_id":"MDQ6VXNlcjUyODkwMTA=","avatar_url":"https://avatars2.githubusercontent.com/u/5289010?v=4","gravatar_id":"","url":"https://api.github.com/users/RobbinBaauw","html_url":"https://github.com/RobbinBaauw","followers_url":"https://api.github.com/users/RobbinBaauw/followers","following_url":"https://api.github.com/users/RobbinBaauw/following{/other_user}","gists_url":"https://api.github.com/users/RobbinBaauw/gists{/gist_id}","starred_url":"https://api.github.com/users/RobbinBaauw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RobbinBaauw/subscriptions","organizations_url":"https://api.github.com/users/RobbinBaauw/orgs","repos_url":"https://api.github.com/users/RobbinBaauw/repos","events_url":"https://api.github.com/users/RobbinBaauw/events{/privacy}","received_events_url":"https://api.github.com/users/RobbinBaauw/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2018-01-13T10:50:03Z","updated_at":"2018-08-25T16:57:48Z","closed_at":"2018-01-29T02:47:40Z","author_association":"NONE","body":"Hello, I posted a comment on a [closed issue](https://github.com/laurb9/StepperDriver/issues/32) and didn't see it appearing anywhere, so I'm copying it here and removing the comment in that issue. Anyway, I was also trying to understand the non-blocking sketch. I use the [Blynk](http://docs.blynk.cc/#blynk-firmware-blynktimer) library for communication with a server and lots of timers so that nothing blocks the loop. \r\n\r\nAt the moment I solve the blocking problem by making the stepper part of the code run in a timer every 100 milliseconds, and rotating the exact degrees taking 100 milliseconds, then performing the rest of the code and then doing that all over again. It used to work, unfortunately the rest of the program got a bit more complicated and the time it takes to perform calculations in between has increased, so you will see some stuttering, which if unpreferable. Also, serial logging is a no go when using a stepper since it takes up quite a bit of time, which would make the stuttering even worse.\r\n\r\nSo now I'm trying to decide whether the non-blocking sketch would solve these problems. If I understand correctly you set like a target first (the _startMove_ function), then perform a _stop_ function when the other code needs running (for me that would be every 100-300 milliseconds, a timer would then run the stepper.stop() function). Then you calculate the time you have to perform calculations, if this time is smaller then or equal to zero it means the motor has reached its goal and you can perform all the calculations you want. If the time left is bigger than a pre defined value (in the example 100 milliseconds) you would also run your other code. \r\n\r\nI don't know whether this is how it works, but if it works like, what happens in the time of the _stepper.nextAction()_? Does the stepper not do anything which would provide me with the stuttering I already have or does the stepper still move and requires new data after that period of time? \r\n\r\nIf the stuttering can be resolved, I would be really happy. Figuring out how to combine this with the rest of my code is a second thing (timers need to run in the loop, perhaps the if statement with the _wait_time_micros > 100_ in there before calling the run function of the timer) but I'm happy to work on that if this solves the issues I'm currently having. \r\n\r\nThanks in advance!"},"comment":{"url":"https://api.github.com/repos/laurb9/StepperDriver/issues/comments/415982638","html_url":"https://github.com/laurb9/StepperDriver/issues/43#issuecomment-415982638","issue_url":"https://api.github.com/repos/laurb9/StepperDriver/issues/43","id":415982638,"node_id":"MDEyOklzc3VlQ29tbWVudDQxNTk4MjYzOA==","user":{"login":"laurb9","id":5796634,"node_id":"MDQ6VXNlcjU3OTY2MzQ=","avatar_url":"https://avatars0.githubusercontent.com/u/5796634?v=4","gravatar_id":"","url":"https://api.github.com/users/laurb9","html_url":"https://github.com/laurb9","followers_url":"https://api.github.com/users/laurb9/followers","following_url":"https://api.github.com/users/laurb9/following{/other_user}","gists_url":"https://api.github.com/users/laurb9/gists{/gist_id}","starred_url":"https://api.github.com/users/laurb9/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/laurb9/subscriptions","organizations_url":"https://api.github.com/users/laurb9/orgs","repos_url":"https://api.github.com/users/laurb9/repos","events_url":"https://api.github.com/users/laurb9/events{/privacy}","received_events_url":"https://api.github.com/users/laurb9/received_events","type":"User","site_admin":false},"created_at":"2018-08-25T16:57:48Z","updated_at":"2018-08-25T16:57:48Z","author_association":"OWNER","body":"Try taking a look at the AccelStepper library, it has been around for a longer time. \r\nWith interrupts, maintaining the functionality across different chips becomes an issue."}}
{"actor":{"display_login":"laurb9"}}