![]() |
IR Issues in Mplab
We are currently using mplab and we having trouble with the pulses of the remote. Here is an example of our coding:
Code Code:
if (rc_dig_in10 == 1)Code:
unsigned char cmd0()But this makes it so the pulses just pulse the motors forward and do not hold them at constant forward movement. What are other teams doing to rectify/compensate for this? |
Re: IR Issues in Mplab
There doesn't seem to be anything wrong with the code you posted; the error may lie elsewhere.
In the autonomous loop, are you setting the PWMs to 127 every time? |
Re: IR Issues in Mplab
Quote:
if (rc_dig_in10 == 1) { ButtonPressed = TRUE; } [/code] Subroutine[code] if (ButtonPressed == TRUE) { //You could also call your subroutine here if you wanted to pwm01 = pwm02 = 190; //Forward Half Speed return 0; } This will work because the way you had it written, as soon as the button lets go, it equals 0. Since the processor runs every 27 milliseconds or so, it will start, and then quickly stop if pressed once. Doing it the way I showed sets another variable that once it sees the button gets set, and if it gets let go it is still going. If you have anymore questions, let me know. Joey PS I'm not sure if the syntax is perfect, I just wanted to show you the concept. |
Re: IR Issues in Mplab
We were able to figure it out. The issue was with an else branch that we had that was setting the pwm01 and pwm02 equal to 127.
|
| All times are GMT -5. The time now is 04:57. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi