|
#1
|
|||
|
|||
|
Code error?
Alright our team has been trying to run a motor through a pwm with the buttons on the joystick.
Code:
if (p1_sw_aux1 = 1 && p1_sw_aux2 = 0)
{
pwm10 = 255
}
else if (p1_sw_aux1 = 0 && p1_sw_aux2 = 1)
{
pwm10 = 0
}
else
{
pwm10 = 127
}
We also tried just using pwm10 = 255 to see if anything would happen and we got absolutely nothing in return. The motor just constantly sits there, we think its an electrical problem but we are still getting told its a programming error. If this is true can anyone tell us what it is we are doing wrong? |
|
#2
|
|||||
|
|||||
|
Re: Code error?
Quote:
in the if then, you have to use two = signs (like this ==) |
|
#3
|
|||
|
|||
|
Re: Code error?
We have tried that as well and it returned nothing. (I am not at our coding laptop and do not have a copy of the code with me so I am throwing the code out from memory.)
|
|
#4
|
|||||
|
|||||
|
Re: Code error?
when you turn the robot on, what do the victor lights do? if they are blinking orange, then you should check the pwm wires to make sure they're fully in
|
|
#5
|
|||||
|
|||||
|
Re: Code error?
just to clarify, that means u just put pwm10 = 255 without any if-then statements right?
|
|
#6
|
|||||
|
|||||
|
Re: Code error?
did you copy paste the code from the actual code? or did you just type it up as an example. because you are missing semi-colons at the ends of your lines, too.
|
|
#7
|
|||
|
|||
|
Re: Code error?
I believe it may be the victors, i remember seeing orange lights but the electric team said it was normal. Yes, i meant without any if statements, and i just threw it out from memory. I never can remember those semi colons XD
|
|
#8
|
|||||
|
|||||
|
Re: Code error?
http://ifirobotics.com/docs/ifi-v884...al-9-25-06.pdf
take a look at the third page. it describes what the lights mean and how to troubleshoot the victor |
|
#9
|
|||||
|
|||||
|
Re: Code error?
Step back from the immediate problem a bit and make sure the larger environment is okay. Are you certain you're downloading the newly created .hex file? Are you even certain you're successfully compiling the program in the first place? In addition to the incorrect equality test, the code you posted has some missing semicolons that I would have expected to cause syntax errors.
|
|
#10
|
|||
|
|||
|
Re: Code error?
We had been messing with the pwm cords prior to the testing, as we didn't know for sure which way they were supposed to go in. We may not have put it in fully.
Thank you |
|
#11
|
|||||
|
|||||
|
Re: Code error?
Yea, make sure the black side of the pwm is lined up with the B on the victor, and that the pwm's are in firmly. good luck!
|
|
#12
|
||||
|
||||
|
Re: Code error?
Sorry to ask the obvious question but,
pwm10? Are you sure you did not mean pwm01? Try putting in a printf and then let the loader open the terminal window after programming. Leave the programming cable on. (Its a good idea to put blocks under any drive wheels while running with a computer connected to the robot) Add this line printf("p1_sw_aux1 = %d, p1_sw_aux2 =%d\r", p1_sw_aux1, p1_sw_aux2); What buttons are you pressing? The trigger is p1_sw_trig, and the thumb switch is p1_sw_top, I don't think the aux inputs are connected to anything on the joystick. As for setting the motor to 255, every time in the loop it should always go. Brian |
|
#13
|
|||
|
|||
|
Re: Code error?
Yes i mean pwm10 thats the pwm we are using, and we have tested the aux buttons they are attached to buttons on the top of our joystick. Today we went back and looked and found that we hade a bad victor, we are getting that fixed now. Thank you to all who helped.
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Code Error? | darkdwarven | Programming | 1 | 08-02-2008 00:42 |
| Error in code light on, trouble finding error | Bryan Herbst | Programming | 16 | 12-10-2007 21:59 |
| Code error on RC after downloading "bells and whistles" version of Kevins camera code | DanDon | Programming | 6 | 10-01-2006 18:07 |
| Error w/ FRC code | JamesBrown | Programming | 2 | 08-01-2005 16:17 |
| C++ Code Error? | Adam Shapiro | Programming | 9 | 20-01-2003 13:24 |