Go Down

Topic: input in serial :use it as value for positioning 3 steppers (Read 69 times) previous topic - next topic

Rebelstudios

Hey guys,

For my 3 axis cameraslider:

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

 

Robin2

Is this a program you wrote yourself?

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.

Quote
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.

There is some simple user input code in Planning and Implementing a Program

Your program uses
Code: [Select]
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.


...R
Two or three hours spent thinking and reading documentation solves most programming problems.

Rebelstudios

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!!




Robin2

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
Code: [Select]
void joyswitchclick ()  {
   switchClicked = true;
}


...R
Two or three hours spent thinking and reading documentation solves most programming problems.

Go Up