Subject:
|
Re: Hi folks a question about ic.
|
Newsgroups:
|
lugnet.robotics.handyboard
|
Date:
|
Sun, 2 Feb 1997 03:49:36 GMT
|
Original-From:
|
Richard Vannoy <RICHARDV@ABACavoidspam.COM>
|
Reply-To:
|
RICHARDV@ABACnospam.COM
|
Viewed:
|
507 times
|
| |
| |
> Hi, is there some kind of integer to float call in ic? I am trying to write a
> test servo routine that takes the knob() value and turns the servo to that
> number of degrees using servo_deg() which takes a float. Any ideas?
In regular C, you just ask for what you want by declaring the convert in
a statement like...
Knob_value = knob();
How_much = float(knob_value);
servo_deg(How_much);
or save a variable with...
Knob_value = knob;
servo_deg(float(Knob_value));
Try those....... or... what I recently did...
(since you have no SELECT CASE), something like..
value = knob();
if(value>200) servo_deg(-90.0);
else
if(value>150)
{
servo_deg(-45.0);
printf("-45 degrees"); // Use or delete printf's as you
want
}
else
if(value>100) servo_deg(0.0);
else
if(value>50) servo_deg(45.0);
else
servo_deg(90.0);
|
|
Message is in Reply To:
| | Hi folks a question about ic.
|
| Hi, is there some kind of integer to float call in ic? I am trying to write a test servo routine that takes the knob() value and turns the servo to that number of degrees using servo_deg() which takes a float. Any ideas? My board was just recenly (...) (28 years ago, 1-Feb-97, to lugnet.robotics.handyboard)
|
2 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|