I have a perfect working program for setting IN and OUT points. There is only one thing i dont like about it...
It is user unfriendly
It thaks a lot of time to set the IN and OUT points because it uses the joystick to move steppers into position and than (when the desired position is reached) it sets the current positions of the steppers as value is for IN or OUT.
Than it asks (though the serialmonitor) to set a speed for the motors
When all the info is there (IN points, OUT point, and Speed) it just asks for a IN or OUT point to travel to
If you like this you can download it from the attachments
but
My question is:
Can i make the serial just ask for the IN, OUT, and Speed in stead of moving them to those points first?
and when "complete on info" just aks : traving to IN or OUT .... or reset the values
i also like to add the function: travel automatic (for a nr# of times) from IN to OUT with a delay when reached one of those points
You should not have any Serial.print() statements in the Interrupt Service Routine (ISR) joyswitchclick() Serial is very slow and an ISR that takes 100 microseconds would be very long.
What is the variable inandout intended to record. The numbers 1, 2 and 3 are not informative.
Can i make the serial just ask for the IN, OUT
You can make it ask for anything you want. Planning an effective and intuitive user interface requires considerable thought before you start any programming. Drawing (or writing) the different screen messages on a piece of paper can be a very effective way to think about it.
StepperControl.runSpeedToPosition(); // Blocks until all are in position
which, as the comment says, blocks until the movement is complete. That makes for a very unresponsive program. using the non-blocking run() would be better.
Thanks for your replay, I didn't make this myself but i added a 3th stepper to it.
quote:
You should not have any Serial.print() statements in the Interrupt Service Routine (ISR) joyswitchclick() Serial is very slow and an ISR that takes 100 microseconds would be very long.
im not sure what you mean by this
the longest line to travel is 13500 microsteps about 1 meter 20 cm ..the other 2 are max half a revolution.
quote
There is some simple user input code in Planning and Implementing a Program
going trou it now ... very nive to explain coding this way ..Thanks!!
Rebelstudios:
quote:
You should not have any Serial.print() statements in the Interrupt Service Routine (ISR) joyswitchclick() Serial is very slow and an ISR that takes 100 microseconds would be very long.
im not sure what you mean by this
I mean exactly what I said. ISRs should be as short as possible and 100 microseconds is probably too long. Use the ISR to note that something has happened so that code somewhere else in the program knows to do stuff. It is probably sufficient to reduce your ISR to