converting numbers
Archiver
Posts: 46,084
Hello all: I am using the sharp GP2D02 it outputs a large number for close
range and a small number for far range detection. 225 for minimum
distance,and around 75 for maximum distance. How can I flip this number
sequence so that my program can display a high value for long distance,and a
small value for short distance?
I had thought of a lookdown table or some such,but boy that would be messy
and take up a lot of wasted program space.
IS there a way to do this with a math equation somehow? Ultimately I then
wanted to convert the number sequence into some human readable form for LCD
display output. a simple inch system 1 to 24 inchs since that is about the
maximum range of the sharp
Thankyou everyone.
Sincerely
Kerry
Admin@M...
WWW server hosting
[url=Http://mntnweb.com]Http://mntnweb.com[/url]
Binghamton online Webcam [url=Http://MntnWeb.Com/bing.htm]Http://MntnWeb.Com/bing.htm[/url]
CHRISTMAS Web Page [url=Http://mntnweb.com/xmas.htm]Http://mntnweb.com/xmas.htm[/url]
--So you think you need more memory... the LEM went to the moon on 16K,how
much do you REALLY need?
range and a small number for far range detection. 225 for minimum
distance,and around 75 for maximum distance. How can I flip this number
sequence so that my program can display a high value for long distance,and a
small value for short distance?
I had thought of a lookdown table or some such,but boy that would be messy
and take up a lot of wasted program space.
IS there a way to do this with a math equation somehow? Ultimately I then
wanted to convert the number sequence into some human readable form for LCD
display output. a simple inch system 1 to 24 inchs since that is about the
maximum range of the sharp
Thankyou everyone.
Sincerely
Kerry
Admin@M...
WWW server hosting
[url=Http://mntnweb.com]Http://mntnweb.com[/url]
Binghamton online Webcam [url=Http://MntnWeb.Com/bing.htm]Http://MntnWeb.Com/bing.htm[/url]
CHRISTMAS Web Page [url=Http://mntnweb.com/xmas.htm]Http://mntnweb.com/xmas.htm[/url]
--So you think you need more memory... the LEM went to the moon on 16K,how
much do you REALLY need?
Comments
y = 225-x
So at 225, y = 0 an at 75 it equals 150. Then you could scale it up as you
like. Assuming it is linear, you'd use y=mx+b where m is the slope and b is
the zero offset:
y=m(255-x)+b
Does that help?
Regards,
Al Williams
AWC
* Control 8 servos at once! http://www.al-williams.com/awce/pak8.htm
>
Original Message
> From: Kerry Barlow [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=EAkxlB29SmVVMJ5RU_QNjo2UtUlxMB2v7ELmca5NJ2aK8ojphWkesn-nSiG0yLRJTW1pPC7w80EKDCo]admin@m...[/url
> Sent: Thursday, September 28, 2000 10:00 AM
> To: basicstamps@egroups.com
> Subject: [noparse][[/noparse]basicstamps] converting numbers
>
>
> Hello all: I am using the sharp GP2D02 it outputs a large number
> for close
> range and a small number for far range detection. 225 for minimum
> distance,and around 75 for maximum distance. How can I flip this number
> sequence so that my program can display a high value for long
> distance,and a
> small value for short distance?
> I had thought of a lookdown table or some such,but boy that would be messy
> and take up a lot of wasted program space.
> IS there a way to do this with a math equation somehow? Ultimately I then
> wanted to convert the number sequence into some human readable
> form for LCD
> display output. a simple inch system 1 to 24 inchs since that is about the
> maximum range of the sharp
> Thankyou everyone.
>
> Sincerely
> Kerry
> Admin@M...
> WWW server hosting
> [url=Http://mntnweb.com]Http://mntnweb.com[/url]
> Binghamton online Webcam [url=Http://MntnWeb.Com/bing.htm]Http://MntnWeb.Com/bing.htm[/url]
> CHRISTMAS Web Page [url=Http://mntnweb.com/xmas.htm]Http://mntnweb.com/xmas.htm[/url]
> --So you think you need more memory... the LEM went to the moon
> on 16K,how
> much do you REALLY need?
>
>
>
>
>
I have never been good at algebra,no matter how many class;s and tutors I
have had
Thankyou.
At 10:04 AM 9/28/2000 -0500, you wrote:
>Um, how about:
>
>y = 225-x
>
>So at 225, y = 0 an at 75 it equals 150. Then you could scale it up as you
>like. Assuming it is linear, you'd use y=mx+b where m is the slope and b is
>the zero offset:
>
>y=m(255-x)+b
>
>Does that help?
>
>Regards,
>
>Al Williams
>AWC
>* Control 8 servos at once! http://www.al-williams.com/awce/pak8.htm
>
>
>>
Original Message
>> From: Kerry Barlow [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=xjz8b85WGazDR9XkRfo77Bp9cPLvSNyLG0wGEBh8BvpUXRo9kW4_d1iTzHUaYBiVrLlYY5_b0ec]admin@m...[/url
>> Sent: Thursday, September 28, 2000 10:00 AM
>> To: basicstamps@egroups.com
>> Subject: [noparse][[/noparse]basicstamps] converting numbers
>>
>>
>> Hello all: I am using the sharp GP2D02 it outputs a large number
>> for close
>> range and a small number for far range detection. 225 for minimum
>> distance,and around 75 for maximum distance. How can I flip this number
>> sequence so that my program can display a high value for long
>> distance,and a
>> small value for short distance?
>> I had thought of a lookdown table or some such,but boy that would be messy
>> and take up a lot of wasted program space.
>> IS there a way to do this with a math equation somehow? Ultimately I then
>> wanted to convert the number sequence into some human readable
>> form for LCD
>> display output. a simple inch system 1 to 24 inchs since that is about the
>> maximum range of the sharp
>> Thankyou everyone.
>>
>> Sincerely
>> Kerry
>> Admin@M...
>> WWW server hosting
>> [url=Http://mntnweb.com]Http://mntnweb.com[/url]
>> Binghamton online Webcam [url=Http://MntnWeb.Com/bing.htm]Http://MntnWeb.Com/bing.htm[/url]
>> CHRISTMAS Web Page [url=Http://mntnweb.com/xmas.htm]Http://mntnweb.com/xmas.htm[/url]
>> --So you think you need more memory... the LEM went to the moon
>> on 16K,how
>> much do you REALLY need?
>>
>>
>>
>>
>>
>
>
>
>
>
Sincerely
Kerry
Admin@M...
WWW server hosting
[url=Http://mntnweb.com]Http://mntnweb.com[/url]
Binghamton online Webcam [url=Http://MntnWeb.Com/bing.htm]Http://MntnWeb.Com/bing.htm[/url]
CHRISTMAS Web Page [url=Http://mntnweb.com/xmas.htm]Http://mntnweb.com/xmas.htm[/url]
--So you think you need more memory... the LEM went to the moon on 16K,how
much do you REALLY need?