Removed the Delay(10) and now nunchuck.update takes only 1340 microseconds to run. That Delay(10) is what made my I2C call (nunchuck.update) take 11350 microseconds to run. Or are people just letting there steppers run jerky like this?Īfter all that work I found the culprit!!! how do I get around this since I have to keep stepping my motor obviously or it will stop, and I have to go get user input sooner or later.That tells me that every 11500 micro seconds ( or 3100 if I checked every 1 step) I have to wait 11350 microseconds for the IC2 call to finish before I can get back to telling the motor to make its next step. (which times out to be about 11500 micro seconds) While in my code at higher speeds, I let my motor make 5 steps before checking for user input again. That has to be the source of my Jitter I have to assume. The time it takes my step motor to move only one single step is 3100 micro seconds. The time it takes my script to do the IC2 call to the nunchuck to get the user input takes a pretty much constant 11350 microseconds every time. using micros() function this is what I learned. Tonight I took the stopwatch to my script. Thats why I'm doing this, to become better.īack to beating my head against the wall some more. So please excuse me if some of my ways of looking at things is way off base. I try to be a quick learning in it all though. Wont that mean with the stepper stepping, there Never be a chance to check my input with out causing a hiccup in the steps? Or am I still looking at this wrong. if my IC2 wire.read() command takes longer then a single step. My assumption is, that my delay is coming from Wire.read() (looking into Wire.read now) The question is this. Below is the code for what its doing: void ArduinoNunchuk::update()ĪrduinoNunchuk::accelX = (values > 2) & 3) ĪrduinoNunchuk::accelY = (values > 4) & 3) ĪrduinoNunchuk::accelZ = (values > 6) & 3) ĪrduinoNunchuk::zButton = !((values > 0) & 1) ĪrduinoNunchuk::cButton = !((values > 1) & 1) Again the delay comes from nunchuck.update. Both Stepper functions setup with millisecond timers in those libraries. So I ask.Īll I'm really doing is a nunchuck.update call, then I run an appropriately setup tSpeed followed by a Stepper.step. I learned alot looking into that concept all together. All of it is handled with Timers to not keep the processor tied up waiting. Looked into all my included libraries, and looked at how the motor stepping is handled.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |