Am I being really obtuse?
Hugh
Posts: 362
I'm having one of those occasions where the apparently obvious doesn't work as I expected. Would someone please be kind enough to point out the problem that I just can't see for staring at it so long?
All I want to do is to set one pin high, the other low.
This code does not work (indicator LEDs stay unlit)
This code does work, with the indicator LEDs toggling between lit / unlit at half-second intervals
I have checked this so many times.
Why?!
All I want to do is to set one pin high, the other low.
This code does not work (indicator LEDs stay unlit)
[B]dira[/B][16]~~ ' Set pin 16 to output [B]outa[/B][16]~ ' Set pin 16 low [B]dira[/B][17]~~ ' Set pin 17 to output [B]outa[/B][17]~~ ' Set pin 17 high
This code does work, with the indicator LEDs toggling between lit / unlit at half-second intervals
[B]dira[/B][16]~~ ' Set pin 16 to output [B]outa[/B][16]~ ' Set pin 16 low [B]dira[/B][17]~~ ' Set pin 17 to output [B]outa[/B][17]~~ ' Set pin 17 high [B]repeat[/B] [B]outa[/B][17] := ![B]outa[/B][17] ' Toggle pin 17 [B]outa[/B][16] := ![B]outa[/B][16] ' Toggle pin 16 [B]waitcnt[/B]([B]cnt[/B]+4000000)
I have checked this so many times.
Why?!
Comments
Yes, but as frida showed: we didn't look to what is not coded ;-)
You need a repeat at the end, else close the propeller down.
The toggle operation does not need an assignment, just use the right side of your code that is in your repeat (which btw is correct)
!outa[16] will by itself toggle pin 16
Thank you
or:
You also could code:
At least: I hope it will do ;-)