![]() |
Programming: MotorRcControl() vs GetRxInput()/SetServo()
Ok, I've been beating my head against this for a couple of days and haven't solved the problem. If I do the following, things work fine:
while(1) { // control motor connected to #8 with channel #3 MotorRcControl(1, 3, 8, 0); } ...but the following makes the servos connected to the uController go nuts: int armASpeed = 0; while(1) { // control motor connected to #8 with channel #3 armASpeed = GetRxInput(1, 3); PrintToScreen("armASpeed: %d", armASpeed); SetMotor(8, armASpeed); } Also, I see a value of 127 returned, no matter the position of the R/C stick. If I comment out the SetMotor() call I see the value of armASpeed change with the R/C stick position, as I would expect. So, it appears to be related to the SetMotor() call. I've checked the arguments against the UserAPI.h headers. Do I have a syntax problem? Is it timing? I don't trust this dual processor arrangement (it seems fragile) and I suspect it might be involved. Thanks, -Glenn |
Re: Programming: MotorRcControl() vs GetRxInput()/SetServo()
An earlier search didn't turn up anything on SetMotor() or SetServo() but a second search turned up some examples using SetPWM(). I believe my problem has to do with the size of the variable I was using as an argument. Things seem to be working if I use:
unsigned char armASpeed = 0; while(1) { armASpeed = GetRxInput(1,3); PrintToScreen("armASpeed: %d\n",(int)armASpeed); SetPWM(8, armASpeed); } Thanks, -Glenn |
Re: Programming: MotorRcControl() vs GetRxInput()/SetServo()
These commands look interesting. Are they available in EasyC 1.1 or are they from EasyC 2.0? I'm looking for a way to control the two motors in the SquareBot using channel 2 and 3 and then also control the servo using Channel 3 joystick with a side to side motion. The default system works this way, but when I use EasyC to combine autonomy with RC, this ability goes away. Any ideas would be appreciated.
EDIT: Silly me. The commands I was asking about are available in EasyC 1.1, you just have to choose Professional Level via the Options menu. Duh! |
Re: Programming: MotorRcControl() vs GetRxInput()/SetServo()
Quote:
Code:
#include "UserAPI.h" |
Re: Programming: MotorRcControl() vs GetRxInput()/SetServo()
Quote:
Are you using V1? If so, look at the help because I think the correct use is described there. But if you are, I'd suggest tryng to upgrade to V2 since it has some nice extra features (like user functions) and all that stuff is cleaned up. |
| All times are GMT -5. The time now is 17:47. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi