Thread: Basic Math Help
View Single Post
  #9   Spotlight this post!  
Unread 14-02-2007, 13:39
buddy.smith buddy.smith is offline
Master Control
FRC #1795
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 2007
Location: atlanta
Posts: 20
buddy.smith is an unknown quantity at this point
Re: Basic Math Help

Okay, let's look at this another way.

Your analog sensor gives you a value of 0-255
Your motor takes a value of 0-255

So, why are you using a float?

At the worst case, you could use a look up table.

You have your complicated formula you want to use. Use your formula to make an array. Then, you just need:
Code:
myvalue = LookUpTable[GetAnalogValue(....)];
Make sense?

Or, you can forget about inches, and deal with everything in the domain of 0-255, whatever units they happen to be