Thread: Code error?
View Single Post
  #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: 769
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