View Single Post
  #25   Spotlight this post!  
Unread 11-05-2011, 12:04
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Offseason Project: Holonomic Kiwi Drive Robot

Quote:
Originally Posted by EthanMiller View Post
I changed the code on the NXT to be -.5 instead of -1/2 and it works fine now - Why is that?
1 is an integer. 2 is an integer. When C sees "1/2", it does an integer division and produces an integer result. The integer result of 1/2 is 0.

I assume writeDebugStreamLine() uses the same format strings as the C standard library? %d specifies an int. If you give it a double (a floating point value), the number will be interpreted (and printed) incorrectly. Use %f instead.