View Single Post
  #2   Spotlight this post!  
Unread 19-05-2005, 10:39
Mark McLeod's Avatar
Mark McLeod Mark McLeod is offline
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,801
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
Re: PBASIC operator interface LED problems

Your joysticks are plugged into OI ports 1 & 2?

Your joystick may not be giving you full range and falling into the ranges set in the default code for the OI LEDs.
You can try expanding the ranges to be any forward and any reverse value rather than only the top/bottom of the normal range. You might also like to increase the range where both lights are on.
This is the way the default code is now for OI Port 1:
Code:
select (p1_y) 'Check position of Port 1 Joystick
	case 0 to 56 'Joystick is in full reverse position
		Out8 = 0 ' Turn PWM1 green LED - OFF
		Out9 = 1 ' Turn PWM1 red LED - ON 
	case 125 to 129 'Joystick is in neutral position
		Out8 = 1 ' Turn PWM1 Green LED - ON
		Out9 = 1 ' Turn PWM1 red LED - ON 
	case 216 to 255 'Joystick is in full forward position
		Out8 = 1 ' Turn PWM1 Green LED - ON 
		Out9 = 0 ' Turn PWM1 red LED - OFF
	case else 'In either forward or reverse position
		Out8 = 0 ' Turn PWM1 green LED - OFF
		Out9 = 0 ' Turn PWM1 red LED - OFF
endselect

Try changing the ranges to:
Code:
select (p1_y) 'Check position of Port 1 Joystick
	case 0 to 124 'Joystick is in full reverse position
		Out8 = 0 ' Turn PWM1 green LED - OFF
		Out9 = 1 ' Turn PWM1 red LED - ON 
	case 125 to 129 'Joystick is in neutral position
		Out8 = 1 ' Turn PWM1 Green LED - ON
		Out9 = 1 ' Turn PWM1 red LED - ON 
	case 130 to 255 'Joystick is in full forward position
		Out8 = 1 ' Turn PWM1 Green LED - ON 
		Out9 = 0 ' Turn PWM1 red LED - OFF
	case else 'In either forward or reverse position (unused)
		Out8 = 0 ' Turn PWM1 green LED - OFF
		Out9 = 0 ' Turn PWM1 red LED - OFF
endselect

Do the same for OI Port 2.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle

Last edited by Mark McLeod : 19-05-2005 at 10:50.