Board Thread:Questions and Answers/@comment-121.214.142.199-20121212050300/@comment-86.152.15.218-20121214173450

Might not be related, but I found I needed to build in a slightly longer delay than 7 ticks when doing a lot of repeated moves. Might have been because the frame motors didn't always complete the previous move in time or because they don't keep up with the bluetricity needed with a number of repeated moves. More usefully though, don't write the code long hand like that. Create a word to move 1 step first:

> : CLOSE1

compile: 1 IOXRST

compile: 10 TICKS

compile: 1 IOXSET

compile: 10 TICKS

compile: 1 IOXRST

compile: ;

Then call that word however many times you need to close things:

>  : CLOSE

compile: 6 TIMES CLOSE1 ;

Forth is a very modular language, always aim to define things in small units which can be built upon. Even better would be to have the "CLOSE1" word take the value to be used to step the motor from the stack so it can be passed into it and can then be re-used to step any motor you add later. Also, aim to use the IOXSET and IOXRST rather than IOX! as then you can address individual bits directly.