Skip to content

Commit

Permalink
Stop/start buttons work
Browse files Browse the repository at this point in the history
  • Loading branch information
gniezen committed Sep 2, 2014
1 parent b5f52f4 commit 8c4adb8
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions ui/ui.ino
Original file line number Diff line number Diff line change
Expand Up @@ -70,16 +70,17 @@ void loop()
digitalWrite(dirpin, HIGH); // Set the direction.

unsigned long currentMillis = millis();

if(currentMillis - previousMillis > timeBetweenSteps) {
// save the last time you blinked the LED
previousMillis = currentMillis;

for (int i = 0; i<10; i++) // number of microsteps at one time
{
digitalWrite(steppin, LOW);
digitalWrite(steppin, HIGH); // Creates 'rising edge'
delayMicroseconds(5000); //motor speed
if(running) {
if(currentMillis - previousMillis > (timeBetweenSteps-positionLeft)) {
// save the last time you blinked the LED
previousMillis = currentMillis;

for (int i = 0; i<10; i++) // number of microsteps at one time
{
digitalWrite(steppin, LOW);
digitalWrite(steppin, HIGH); // Creates 'rising edge'
delayMicroseconds(500); //motor speed
}
}
}

Expand Down Expand Up @@ -132,7 +133,7 @@ void loop()
GD.cmd_text(140,175+offset1, 31, OPT_CENTERX,"Start");

GD.Tag(2);
GD.ColorRGB(0xff0000);
GD.ColorRGB(0xff2e18);
if(pressed == 2) {
GD.Vertex2ii(230,174,BUTTON1_HANDLE);
offset2=4;
Expand Down

0 comments on commit 8c4adb8

Please sign in to comment.