Help with Arduino code
#10
That information helps Chuck.

Looking at the code:

Code:
if(Degrees < 0)
   {
     ToMove = (Degrees*Multiplier)*-1;
     lcd.setCursor(0,0);
     lcd.print("REV");
     lcd.print(abs(Degrees),2);
     lcd.print((char)223);
     lcd.setCursor(8,1);
     lcd.print("Moving");
     rotation(ToMove,0);
     lcd.setCursor(8,1);
     lcd.print("      ");      
   }

The rotation function gets passed a negative number via ToMove.

The rotation function:

Code:
void rotation(float tm, int d)
{  
 if(d == 0)
 {
   digitalWrite(dir, LOW);
 }
 else
 {
   digitalWrite(dir, HIGH);
 }
 
 for(int i = 0; i < tm; i++)  
  {    
   digitalWrite(stp, HIGH);  
   delay(stepdelay);              
   digitalWrite(stp, LOW);  
   delay(stepdelay);              
  }
}

has a "for" loop who's counter is compared to that negative number. I don't think the counter will ever be less than that negative number so the loop won't ever run. I think Arvid needs to verify that since it makes my brain hurt.   Blush

Ed
Reply
Thanks given by:


Messages In This Thread
Help with Arduino code - by chucketn - 04-04-2015, 02:33 PM
RE: Help with Arduino code - by Vinny - 04-04-2015, 02:52 PM
RE: Help with Arduino code - by EdK - 04-04-2015, 05:21 PM
RE: Help with Arduino code - by chucketn - 04-04-2015, 06:19 PM
RE: Help with Arduino code - by EdK - 04-04-2015, 06:49 PM
RE: Help with Arduino code - by Vinny - 04-04-2015, 07:05 PM
RE: Help with Arduino code - by chucketn - 04-05-2015, 06:34 AM
RE: Help with Arduino code - by arvidj - 04-05-2015, 08:43 AM
RE: Help with Arduino code - by chucketn - 04-05-2015, 09:40 AM
RE: Help with Arduino code - by EdK - 04-05-2015, 09:57 AM
RE: Help with Arduino code - by EdK - 04-05-2015, 10:38 AM
RE: Help with Arduino code - by chucketn - 04-05-2015, 10:09 AM
RE: Help with Arduino code - by EdK - 04-05-2015, 10:19 AM
RE: Help with Arduino code - by chucketn - 04-05-2015, 12:20 PM
RE: Help with Arduino code - by EdK - 04-05-2015, 02:50 PM
RE: Help with Arduino code - by Vinny - 04-05-2015, 04:25 PM
RE: Help with Arduino code - by chucketn - 04-05-2015, 06:22 PM
RE: Help with Arduino code - by EdK - 04-05-2015, 06:49 PM
RE: Help with Arduino code - by Vinny - 04-05-2015, 06:50 PM
RE: Help with Arduino code - by EdK - 04-06-2015, 08:29 AM
RE: Help with Arduino code - by chucketn - 04-06-2015, 11:25 AM
RE: Help with Arduino code - by EdK - 04-06-2015, 11:48 AM
RE: Help with Arduino code - by Vinny - 04-06-2015, 03:47 PM
RE: Help with Arduino code - by EdK - 04-06-2015, 05:26 PM
RE: Help with Arduino code - by EdK - 04-06-2015, 05:34 PM
RE: Help with Arduino code - by Vinny - 04-06-2015, 05:41 PM
RE: Help with Arduino code - by EdK - 04-06-2015, 05:44 PM
RE: Help with Arduino code - by chucketn - 04-06-2015, 05:58 PM
RE: Help with Arduino code - by chucketn - 04-06-2015, 06:00 PM
RE: Help with Arduino code - by chucketn - 04-06-2015, 06:07 PM
RE: Help with Arduino code - by Vinny - 04-06-2015, 07:48 PM
RE: Help with Arduino code - by EdK - 04-07-2015, 05:41 AM
RE: Help with Arduino code - by chucketn - 04-07-2015, 08:02 AM
RE: Help with Arduino code - by chucketn - 04-07-2015, 08:06 AM



Users browsing this thread: 3 Guest(s)