Is there a single command to turn on an LED for a given time

hookset

New Member
Instead of using
High
pause
Low
I've been trying the plusout command, but it's not working as I thought it would (pulseout B.2, 3000 ;turn B.2 high for 3 secs).
So is there a single command that will work to turn a pin high for a set period of time.

Thanks,
 

neiltechspec

Senior Member
Using your values.

That will only set the pin high for 30ms (at default 4mhz clock). See manual 2 page 161, add a couple more 00's (up to max 65535).

You also need to set the pin low before the pulsout.

Code:
#picaxe 08m2

main:
low b.2
pulsout b.2,3000
pause 3000
goto main
Neil
 

hippy

Ex-Staff (retired)
PULSOUT times are multiples of 10us ( at 4MHz ) so 3000 = 30000us = 30ms.

There is no longer version of PULSOUT and the maximum time is 655350us ( at 4MHz ) or just over 650ms. If you want a long flash the HIGH : PAUSE : LOW is the way to go. You can put that inside a macro using PE6 to make it more elegant in the main body of the source code ...

Code:
[color=Navy]#Macro [/color][color=Black]LongFlash[/color][color=Blue]( [/color][color=Black]pin, flashTime [/color][color=Blue])
  High  [/color][color=Black]pin
  [/color][color=Blue]Pause [/color][color=Black]flashTime
  [/color][color=Blue]Low   [/color][color=Black]Pin[/color]
[color=Navy]#EndMacro[/color]

[color=Blue]Do
  [/color][color=Black]LongFlash[/color][color=Blue]( B.2[/color][color=Black], [/color][color=Navy]3000 [/color][color=Blue])
  Pause [/color][color=Navy]1000[/color]
[color=Blue]Loop[/color]
 

hookset

New Member
Thanks guys,
Hippy I haven't read up on Macro's yet, so I know what i'll be doing between church service today..
 
Top