|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
we need help with PWM problem in autonomous
We're getting strange pwm trouble in Autonomous Mode. If I put pwm13 = pwm14 = 127 in User_Autonomous_Code(), the speed controller's LED are green and motors turn. If I use pwm13 = pwm14 = 0 or if I use pwm13 = pwm14 = 255, both make LEDs turn off and motors spin opposite. If I do this in the default routine, it works right: 127, LEDs are orange; 255,green and 0 red.
Can anyone tell my why the PWMs act different in Default and Autonomous? here's the code in User_Autonomous_Code() : ... /* Add your own autonomous code here. */ Remote_Controls(); Generate_Pwms(pwm13,pwm14,pwm15,pwm16); Putdata(&txdata); /* DO NOT DELETE, or you will get no PWM outputs! */ ... } void Remote_Controls() { // if Remote # 2 is pressed, stop if (rc_dig_in02==0) { pwm13 = pwm14 = 127; pwm15 = pwm16 = 127; } // if Remote # 3 is pressed, backup if (rc_dig_in03==0) { pwm13 = pwm14 = 0; pwm15 = pwm16 = 0; } // if Remote # 4 is pressed, fwd if (rc_dig_in04==0) { pwm13 = pwm14 = 255; pwm15 = pwm16 = 255; } } |
|
#2
|
|||
|
|||
|
Re: we need help with PWM problem in autonomous
in your code where it says
if (rc_dig_in13==0) You need to put == 1 If you are looking for 0 that means you never pressed a button. If you press the stop button with your code it makes it 1, so it skips the if statement you want it to go to, and goes to the reverse one. I think I explained it ok, if I didnt, ley me know. Joey |
|
#3
|
|||
|
|||
|
Re: we need help with PWM problem in autonomous
rc_dig_in13==0 means the switch is closed; on the robot controller's digital input/output port, the white and black lines are connecting.
But that has nothing to do with why pwm13=127 makes the speed controller go full forward, like I said above. |
|
#4
|
||||
|
||||
|
Re: we need help with PWM problem in autonomous
When you say pwm13=127, is that within one of the IR ifs or just a direct assignment? There should be no reason the code is different in the two functions, it is very strange.
|
|
#5
|
|||
|
|||
|
Re: we need help with PWM problem in autonomous
At first in the IR ifs, but when it was acting strange,I began to try it everyway I could think of, finally even with direct assignments, printing out the values to make sure, and it always acted like that. I cut and paste it into Default_Routine() and it was fine. I wonder if somehow I'm generating PWMs to often or something, but I don't see where.
|
|
#6
|
|||||
|
|||||
|
Re: we need help with PWM problem in autonomous
The comments in the code seem to indicate that you're using the IR sensor board. That board doesn't provide a switch closure to ground. It provides a voltage output: 0 means the signal is not detected, and 1 means it is. If your digital inputs are coming from the IR board, you do have your tests backwards.
|
|
#7
|
|||
|
|||
|
Re: we need help with PWM problem in autonomous
Thanks. No, for troubleshooting I was using a jumper on the inputs, no IR reciever connected. That's why if digtal in ==0.
|
|
#8
|
||||
|
||||
|
Re: we need help with PWM problem in autonomous
Oh, sorry I didn't notice before... Go look at the sticky topic about PWM 13-16 replacement code... Those ones are different from the rest, if you'll read. Or just change the PWMs to a lower value and see what happens. That's almost definitely the issue.
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Problem with PWM outputs on RC | Adam Richards | Control System | 1 | 20-02-2007 06:37 |
| I have a BIG problem with my controller, need help. | razer | Control System | 7 | 12-01-2007 06:21 |
| HELP needed, problem with streamling, need uploading space or diffrent solution... | Nimmy | General Forum | 5 | 15-02-2006 11:18 |
| need help with autonomous | caderader | Programming | 3 | 14-02-2005 18:25 |
| PWM problem in autonomous | outofcontrol | Programming | 5 | 27-02-2004 11:58 |