View Single Post
  #2   Spotlight this post!  
Unread 14-09-2015, 19:02
Caleb Sykes's Avatar
Caleb Sykes Caleb Sykes is offline
Registered User
FRC #4536 (MinuteBots)
Team Role: Mentor
 
Join Date: Feb 2011
Rookie Year: 2009
Location: St. Paul, Minnesota
Posts: 1,048
Caleb Sykes has a reputation beyond reputeCaleb Sykes has a reputation beyond reputeCaleb Sykes has a reputation beyond reputeCaleb Sykes has a reputation beyond reputeCaleb Sykes has a reputation beyond reputeCaleb Sykes has a reputation beyond reputeCaleb Sykes has a reputation beyond reputeCaleb Sykes has a reputation beyond reputeCaleb Sykes has a reputation beyond reputeCaleb Sykes has a reputation beyond reputeCaleb Sykes has a reputation beyond repute
Re: Cutting down motor power

You are likely running into problems with integer division. If you do not put decimal points on your numbers, the compiler will assume that you are using integers. In integer land, multiplying by 5/3 is the same as multiplying by 1, which should cause no change in the elevator motion, and multiplying by 3/5 is the same as multiplying by 0, which explains your lack of elevator movement.

You have already found the easiest solution, which is to just use 0.6 instead of 3/5. If you want to use 3 and 5, write them as 3.0 and 5.0, which will tell the compiler that these are floating point numbers, and thus can have a floating point quotient.
Reply With Quote