ajkw Senior Member
 Joined: 29/06/2011 Location: AustraliaPosts: 290 |
| Posted: 10:46am 30 Jun 2011 |
|
|
|
Sparky,
I think I got it :-)
Maybe you can set a pulse width with the following added to my first example.
3 pwm = 0
4 pinstate = 1
5 setpin 10,8 'pin 10 as output
10 settick 10,1000
15 settick 10,2000 'you can only have one settick at a time, this one overrides any other, it would be nice to have more. GG??
20 rem main program
30 rem doing stuff
40
60
900 goto 20
1000 rem square wave on pin 10 at set tick interval
1010 pinstate = not(pinstate)
1020 pin(10) = pinstate
1099 ireturn
2000 rem pwm on pin0, flash the power light (or other digital pin)
2010 pwm=pwm+1: if pwm=100 then pwm=1 'adjust pwm=100 and settick interval to set freq
2010 if pwm<=3 then pin(0)=1 else pin(0)=0 'adjust pwm<=3 to set pulse width this will give 3 on in 100
2020 ireturn
Regards,
Anthony.
|