PDA

View Full Version : Light on light of



Robe
02-26-2005, 01:05 PM
Hello every one
i am trying to turn a led on, off· wiht···a ·signal to the same i/o
one time for on one time for on· and so on.
Could you·please help, ·so·far i got· this

do
if in0 =1 then
high 5
pause 1000

else if in0 = 1 then
low 1
pause 1000

end if

loop
·

Robert Schwartz
02-26-2005, 01:49 PM
Your IF statement doesn't really make sense. The ELSE IF will never be triggered since it has the same condition as the IF statement preceding it. I think that this is what you are trying to do:

LedControl var 0
LED var 1

Start:
DO
IF LedControl = 1 THEN
HIGH LED:
PAUSE 1000:
ELSE IF LedControl = 0 THEN
LOW LED:
PAUSE 1000:
ENDIF
LOOP
END

This will change the LED's status (on or off) depending on whether or not PIN 0 is high or low.
Could you please explain your problem?

Robe
02-26-2005, 02:15 PM
Firts thank you for replying

i am sending a high signal to the stamp to turn the led on

then another high signal again to turn it off and another high signal

to turn it on again, and so on i am trying to turn led off and on

with the same high signal to the same i/o over and over again.

Beau Schwabe
02-26-2005, 03:17 PM
The you need something more like this...





LOW 1
Start:
DO
IF IN0 = 1 THEN 'Check for P0 to go HIGH
TOGGLE 1 'TOGGLE Output pin P1
PAUSE 1000 'Pause for 1 second Debounce
DO WHILE IN0=1 'Wait for P0 to go LOW (Release)
LOOP
PAUSE 1000 'Pause for 1 second Debounce
ENDIF
LOOP
END


▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
------------------------------------------------------------------------------------
Beau Schwabe - Mask Designer III

National Semiconductor Corporation
(Communication Interface Division)
500 Pinnacle Court, Suite 525
Mail Stop GA1
Norcross,GA 30071
-------------------------------------------------------------------------------------

Post Edited (Beau Schwabe) : 2/26/2005 7:22:52 AM GMT

Robe
02-27-2005, 04:40 PM
Thank you so much