I am currently a physics student and for my final year project I am building a mini CT scanner which involves the use of two stepper motors. I currently have a program working which controlls the motors but i am having difficulty in reversing the rotation. Unlike conventional CT scanners, I must rotate the sample. Would anyone be able to help me figure out how to automatically change the case structure form true to false in order to reverse the stepper motor and without stopping the program.
You need to move your boolean control to be inside of the loop. As of right now, that control is only read once before the loop. By moving it inside, you can read it every iteration.
thanks for the reply. Yes the rotation can now be changed when the program is running but i need help with automatically changing the motor orientation e.g after a certain time interval
From this point, it is just a matter of figuring out what logic you want to be in place of that control.
You can go by the number of iterations and switch if you go beyond a certain count. You could go by your rotations completed. It is just a simple comparison.