Hi Guys I am new to picbasic. I wrote a small program to control a LED with 2 pushbutton switches. The one to switch it on and the other one to switch it off. I can get it to switch it one but when I tried the 2nd button to switch it off it just dim.

Please help

My code:

LED Con 0 ' Alias GPIO.0 to LED
PB Var GPIO.3 ' Alias GPIO.3 to push button
PB1 Var GPIO.4 ' Alias GPIO.4 to push button

ANSEL = 0 ' Set all digital
CMCON = 7 ' Analog comparators off

' Button press turns on LED (MCLRE must not be enabled)
mainloop:
If PB = 1 Then ' If button pressed...
Low LED ' Turn on LED
Else
High LED ' Turn off LED
Endif

If PB1 = 0 Then ' If button pressed...
Low LED ' Turn off LED
Endif

Goto mainloop ' Do it forever

End