Thank you very much everyone has been helpful
Although I was reading on the button command wouldn't that be the easiest way to go?
Thank you very much everyone has been helpful
Although I was reading on the button command wouldn't that be the easiest way to go?
Gotcha I guess I will just go with IF, THEN , GO Statements
How exactly would that work
I know I would have to set LED to HIGH
but is this kind of how it would look
IF port.0=1 THEN
port.1 = high
Something like that?
Here's a better constructed code I made then the one up
Button var PORTB.0 ' Push button
LED1 var PORTB.1 ' Led 1
LED2 var PORB.2 ' Led 2
Pushed var byte ' Variable will contain the byte
If PUSHED =1 Then ' If button is push
High LED1 ' Turn on the LED
IF PUSHED=0 Then
High LED2
Endif
Last edited by Techbuilder; - 12th July 2007 at 23:44.
Just so nobody gets the wrong idea...I'm not being a royal a$$ here....
In your program...(and again, not being an a$$, just trying to get you to understand what's what here)
You have 'If Pushed = 1'...Pushed is a variable...Where is 'Pushed' being set to anything, at least anything that is going to be useful to you?Code:Button var PORTB.0 ' Push button LED1 var PORTB.1 ' Led 1 LED2 var PORB.2 ' Led 2 Pushed var byte ' Variable will contain the byte If PUSHED =1 Then ' If button is push High LED1 ' Turn on the LED IF PUSHED=0 Then High LED2 endif
Instead of taunting people, Jeremy, it would be better to directly point out the error. You'll find that most people don't come to forums asking for help as a first resort.
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
Bookmarks