Subject:
|
256 Motor Power Resolution
|
Newsgroups:
|
lugnet.robotics.handyboard
|
Date:
|
Wed, 6 May 1998 00:24:44 GMT
|
Original-From:
|
Gordon Smith <smithg@gat{spamless}.com>
|
Viewed:
|
1444 times
|
| |
| |
Hi All,
Has anyone noticed that if you slightly modify Julian Skidmore's LIB_HB.C
code that one can get 256 motor power levels rather than 100? I took the
following code in LIB_HB.C:
void motor(int m, int speed)
{
if (speed>100) speed=100;
if (speed<-100) speed=-100;
if (speed >= 0)
_set_motor(m, 0, (255*speed)/100);
else
_set_motor(m, 1, (-255*speed)/100);
}
And then changed the code to the following:
void motor(int m, int speed)
{
if (speed>255) speed=255;
if (speed<-255) speed=-255;
if (speed >= 0)
_set_motor(m, 0, speed);
else
_set_motor(m, 1,(-1*speed));
}
I can now get 256 power levels rather than the previous 100. I have
tested it (but not extensively) and it seems to work OK. Any comments on
this would be appreciated.
Gordon Smith II
Test Engineer
General Atomics Aeronautical Systems
|
|
1 Message in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|