shouldnt it be something like this?
Code:Button var PORTB.0 ' Push button LED1 var PORTB.1 ' Led 1 LED2 var PORB.2 ' Led 2 If Button=1 Then ' If button is push High LED1 ' Turn on the LED IF Button=0 Then High LED2 endif
shouldnt it be something like this?
Code:Button var PORTB.0 ' Push button LED1 var PORTB.1 ' Led 1 LED2 var PORB.2 ' Led 2 If Button=1 Then ' If button is push High LED1 ' Turn on the LED IF Button=0 Then High LED2 endif
You have two IF's but only one ENDIF, so that would error...
Try this... which includes a few additional things to think about....
Finally, check your PBP manual - BUTTON is a reserved word, you can't use it as a variable.Code:ButtonA var PORTB.0 LED1 var PORTB.1 LED2 var PORTB.2 TRISB=%00000001 Loop: If ButtonA=1 then High LED1 LOW LED2 else LOW LED1 HIGH LED2 endif Goto Loop End
Bookmarks