|
Jeff_Rice's code should work for you. If you want some more info on why the original code wouldn't work, read on. Otherwise, just ignore the rest of this.
Here goes:
1. None of the variable names actually mean anything. For example, you could rename relay1_fwd to relay7_rev and as long as you updated the aliases correctly, the Stamp wouldn't know the difference.
2. Just setting a variable won't change the motor itself. In fact, setting the variables are just a matter of convience and allow for more complex processing.
3. The motors are actually set by the values passed to the SEROUT command.
Since the original code never reaches a SEROUT between the relay1_fwd = 1 and the relay1_fwd = 0, the relay will never know the difference. Furthermore, if you don't do a SEROUT at least once every 5 loops (that's ~125ms), you'll get a Basic Run Error. RoboEmu is a little more forgiving and will only complain after 1s which is probably why you didn't get any actual errors.
|