View Full Version : PBASIC operator interface LED problems
John Gutmann
19-05-2005, 07:58
on the operator interface there are the LEDs for the pwm's and the relay's, they al work but just not how they are supposed to, i loaded up the basic code and from what i understand for pwm 1 when the joystick is all they way forward the green LED should be on and when the joystick is all the way back the red LED should be on, and when the joystick is centered both should be on, and the same with the pwm2 and its corrosponding joystcik, but this doesn't happen the LEDs all just randomly blink
Mark McLeod
19-05-2005, 10:39
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:
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:
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.
vBulletin® v3.6.4, Copyright ©2000-2017, Jelsoft Enterprises Ltd.