Go to Post Intent is determined by those that are doing, not those that are watching. - meaubry [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 12-02-2008, 21:58
niagra127 niagra127 is offline
Registered User
FRC #1785
 
Join Date: Jan 2008
Location: Missouri
Posts: 6
niagra127 is an unknown quantity at this point
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
	}
This returned nothing on the motor and we are positive the motor runs.
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   Spotlight this post!  
Unread 12-02-2008, 21:59
Eugene Fang's Avatar
Eugene Fang Eugene Fang is offline
The Blue Alliance
no team
Team Role: Alumni
 
Join Date: Jan 2007
Rookie Year: 2000
Location: Bay Area, CA -> Pittsburgh, PA
Posts: 771
Eugene Fang has a reputation beyond reputeEugene Fang has a reputation beyond reputeEugene Fang has a reputation beyond reputeEugene Fang has a reputation beyond reputeEugene Fang has a reputation beyond reputeEugene Fang has a reputation beyond reputeEugene Fang has a reputation beyond reputeEugene Fang has a reputation beyond reputeEugene Fang has a reputation beyond reputeEugene Fang has a reputation beyond reputeEugene Fang has a reputation beyond repute
Re: Code error?

Quote:
Originally Posted by niagra127 View Post
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
	}
This returned nothing on the motor and we are positive the motor runs.
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?

in the if then, you have to use two = signs (like this ==)
__________________
Eugene Fang
2010 Silicon Valley Regional Dean's List Finalist

Various FLL Teams - Student (2000-2006), Mentor (2007-2010)
FRC Team 604 - Student (2007-2010), Mentor/Remote Advisor (2011-2015)
FRC Team 1323 - Mentor/Remote Advisor (2011-2014)

The Blue Alliance | TBA GameDay | TBA Android App
  #3   Spotlight this post!  
Unread 12-02-2008, 22:01
niagra127 niagra127 is offline
Registered User
FRC #1785
 
Join Date: Jan 2008
Location: Missouri
Posts: 6
niagra127 is an unknown quantity at this point
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   Spotlight this post!  
Unread 12-02-2008, 22:08
Eugene Fang's Avatar
Eugene Fang Eugene Fang is offline
The Blue Alliance
no team
Team Role: Alumni
 
Join Date: Jan 2007
Rookie Year: 2000
Location: Bay Area, CA -> Pittsburgh, PA
Posts: 771
Eugene Fang has a reputation beyond reputeEugene Fang has a reputation beyond reputeEugene Fang has a reputation beyond reputeEugene Fang has a reputation beyond reputeEugene Fang has a reputation beyond reputeEugene Fang has a reputation beyond reputeEugene Fang has a reputation beyond reputeEugene Fang has a reputation beyond reputeEugene Fang has a reputation beyond reputeEugene Fang has a reputation beyond reputeEugene Fang has a reputation beyond repute
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
__________________
Eugene Fang
2010 Silicon Valley Regional Dean's List Finalist

Various FLL Teams - Student (2000-2006), Mentor (2007-2010)
FRC Team 604 - Student (2007-2010), Mentor/Remote Advisor (2011-2015)
FRC Team 1323 - Mentor/Remote Advisor (2011-2014)

The Blue Alliance | TBA GameDay | TBA Android App
  #5   Spotlight this post!  
Unread 12-02-2008, 22:09
Eugene Fang's Avatar
Eugene Fang Eugene Fang is offline
The Blue Alliance
no team
Team Role: Alumni
 
Join Date: Jan 2007
Rookie Year: 2000
Location: Bay Area, CA -> Pittsburgh, PA
Posts: 771
Eugene Fang has a reputation beyond reputeEugene Fang has a reputation beyond reputeEugene Fang has a reputation beyond reputeEugene Fang has a reputation beyond reputeEugene Fang has a reputation beyond reputeEugene Fang has a reputation beyond reputeEugene Fang has a reputation beyond reputeEugene Fang has a reputation beyond reputeEugene Fang has a reputation beyond reputeEugene Fang has a reputation beyond reputeEugene Fang has a reputation beyond repute
Re: Code error?

Quote:
Originally Posted by niagra127 View Post
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
just to clarify, that means u just put pwm10 = 255 without any if-then statements right?
__________________
Eugene Fang
2010 Silicon Valley Regional Dean's List Finalist

Various FLL Teams - Student (2000-2006), Mentor (2007-2010)
FRC Team 604 - Student (2007-2010), Mentor/Remote Advisor (2011-2015)
FRC Team 1323 - Mentor/Remote Advisor (2011-2014)

The Blue Alliance | TBA GameDay | TBA Android App
  #6   Spotlight this post!  
Unread 12-02-2008, 22:10
Eugene Fang's Avatar
Eugene Fang Eugene Fang is offline
The Blue Alliance
no team
Team Role: Alumni
 
Join Date: Jan 2007
Rookie Year: 2000
Location: Bay Area, CA -> Pittsburgh, PA
Posts: 771
Eugene Fang has a reputation beyond reputeEugene Fang has a reputation beyond reputeEugene Fang has a reputation beyond reputeEugene Fang has a reputation beyond reputeEugene Fang has a reputation beyond reputeEugene Fang has a reputation beyond reputeEugene Fang has a reputation beyond reputeEugene Fang has a reputation beyond reputeEugene Fang has a reputation beyond reputeEugene Fang has a reputation beyond reputeEugene Fang has a reputation beyond repute
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.
__________________
Eugene Fang
2010 Silicon Valley Regional Dean's List Finalist

Various FLL Teams - Student (2000-2006), Mentor (2007-2010)
FRC Team 604 - Student (2007-2010), Mentor/Remote Advisor (2011-2015)
FRC Team 1323 - Mentor/Remote Advisor (2011-2014)

The Blue Alliance | TBA GameDay | TBA Android App
  #7   Spotlight this post!  
Unread 12-02-2008, 22:14
niagra127 niagra127 is offline
Registered User
FRC #1785
 
Join Date: Jan 2008
Location: Missouri
Posts: 6
niagra127 is an unknown quantity at this point
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   Spotlight this post!  
Unread 12-02-2008, 22:16
Eugene Fang's Avatar
Eugene Fang Eugene Fang is offline
The Blue Alliance
no team
Team Role: Alumni
 
Join Date: Jan 2007
Rookie Year: 2000
Location: Bay Area, CA -> Pittsburgh, PA
Posts: 771
Eugene Fang has a reputation beyond reputeEugene Fang has a reputation beyond reputeEugene Fang has a reputation beyond reputeEugene Fang has a reputation beyond reputeEugene Fang has a reputation beyond reputeEugene Fang has a reputation beyond reputeEugene Fang has a reputation beyond reputeEugene Fang has a reputation beyond reputeEugene Fang has a reputation beyond reputeEugene Fang has a reputation beyond reputeEugene Fang has a reputation beyond repute
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
__________________
Eugene Fang
2010 Silicon Valley Regional Dean's List Finalist

Various FLL Teams - Student (2000-2006), Mentor (2007-2010)
FRC Team 604 - Student (2007-2010), Mentor/Remote Advisor (2011-2015)
FRC Team 1323 - Mentor/Remote Advisor (2011-2014)

The Blue Alliance | TBA GameDay | TBA Android App
  #9   Spotlight this post!  
Unread 12-02-2008, 22:18
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
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   Spotlight this post!  
Unread 12-02-2008, 22:19
niagra127 niagra127 is offline
Registered User
FRC #1785
 
Join Date: Jan 2008
Location: Missouri
Posts: 6
niagra127 is an unknown quantity at this point
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   Spotlight this post!  
Unread 12-02-2008, 22:21
Eugene Fang's Avatar
Eugene Fang Eugene Fang is offline
The Blue Alliance
no team
Team Role: Alumni
 
Join Date: Jan 2007
Rookie Year: 2000
Location: Bay Area, CA -> Pittsburgh, PA
Posts: 771
Eugene Fang has a reputation beyond reputeEugene Fang has a reputation beyond reputeEugene Fang has a reputation beyond reputeEugene Fang has a reputation beyond reputeEugene Fang has a reputation beyond reputeEugene Fang has a reputation beyond reputeEugene Fang has a reputation beyond reputeEugene Fang has a reputation beyond reputeEugene Fang has a reputation beyond reputeEugene Fang has a reputation beyond reputeEugene Fang has a reputation beyond repute
Re: Code error?

Quote:
Originally Posted by niagra127 View Post
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
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!
__________________
Eugene Fang
2010 Silicon Valley Regional Dean's List Finalist

Various FLL Teams - Student (2000-2006), Mentor (2007-2010)
FRC Team 604 - Student (2007-2010), Mentor/Remote Advisor (2011-2015)
FRC Team 1323 - Mentor/Remote Advisor (2011-2014)

The Blue Alliance | TBA GameDay | TBA Android App
  #12   Spotlight this post!  
Unread 13-02-2008, 08:52
SuperBK's Avatar
SuperBK SuperBK is offline
Registered User
AKA: BrianK
FRC #1225 (Amperage Robotics)
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 2006
Location: Henersonville, NC
Posts: 358
SuperBK is just really niceSuperBK is just really niceSuperBK is just really niceSuperBK is just really nice
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
__________________
Brian K
Team 1225 Robotics Mentor
  #13   Spotlight this post!  
Unread 13-02-2008, 20:35
niagra127 niagra127 is offline
Registered User
FRC #1785
 
Join Date: Jan 2008
Location: Missouri
Posts: 6
niagra127 is an unknown quantity at this point
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.
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

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


All times are GMT -5. The time now is 14:21.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi