Firstly, welcome to the PICAXE forum.
Okay see it comes from PICAXE Manual 3 page 20.
Which PICAXE chip are you using?
This for example will not work correctly as per the diagram in the manual with the 08M and you will only get 0 and 1.
With other PICAXE chips it works as per the manual
When the diagram indicates pin, confirm that you are using the pin designations as in OUT0, OUT1, OUT2 and OUT3. See PICAXE Manual 1 page 8.
The pin numbers are not the physical IC legs. This can be a bit confusing which is why most refer to the physical pins of the IC as "legs".
Can you upload a schematic (wiring) diagram of your circuit and/or a clear photo so we can see the wiring, and specifically to see where each wire end goes, to better help you get your project working.
If you are using the 08M, move from pin 3 to pin 4 then this should work
Code:
main: for b1 = 0 to 9 ‘ Set up a for...next loop using variable b1
let dirs = %000010111 ; [B][COLOR="Red"]required to set up 08M pins 1, 2 and 4 as outputs[/COLOR][/B]. pin 0 auto defaults to an output.
b2 = b1
If b1 > 7 THEN
b2 = b2 AND 7 + 16
ENDIF
let pins=b2 ‘ Output b1 onto the four data lines
pause 1000 ‘ Pause 1 second
next b1 ‘ Next
goto main ‘ Loop back to start
EDIT: it is a good idea to let others know more about your hardware as well as software. Then for example, I would not be guessing that you might have an 08M. Can be good to advise which version of the Programming Editor you are using and maybe your experience level so we know how to pitch the answers.