Arduino stepper motor interface
in
Integration and Hardware
•
2 years ago
Hello!
I'm building an interface in processing (ControlP5) to control a stepper-motor with an ArduinoUNO communicating with "
Arduino Library for Processing (and Firmata)"
I have a probably very simple problem: How do I stop the loop for turning the motor by pressing a button in processing?
- void move (int speed, int turns, int pause, int repeat){
- for (int i = 0; i < repeat; i = i+1) {
- for (int j = 0; j < turns; j = j+1) {
- arduino.digitalWrite(13, Arduino.HIGH);
- delay(speed);
- arduino.digitalWrite(13, Arduino.LOW);
- delay(speed);
- }
- delay(pause);
- }
- }
Since the program is busy with the delays it won't allow me to check a button status while running.
I guess I have to use a timer function but I'm getting confused whether this has to run on the Arduino or in processing.
Can somebody give me a push in the right direction?
1