Troubles with For-Loops (have the prop this)
nomad
Posts: 276
hi.
i have little problem,
i have a BS2-programm for controlling servos
(from my bs2-code)
but i see that spin have no For-Loops
how can i do this with spin:
in the ObjectExchange i find nothing (BS2)
thanks for help, tipps and hints
regards
nomad
a bs2-code snippet:
i have little problem,
i have a BS2-programm for controlling servos
(from my bs2-code)
but i see that spin have no For-Loops
how can i do this with spin:
in the ObjectExchange i find nothing (BS2)
thanks for help, tipps and hints
regards
nomad
a bs2-code snippet:
runningRoll: IF(newRollPulses > oldRollPulses) THEN FOR pulses = oldRollPulses TO newRollPulses + steps DEBUG "Pulses:", DEC pulses, CR PULSOUT RollServo13, pulses PAUSE 20 NEXT oldRollPulses = newRollPulses DEBUG "5\r",CR IF(newRollPulses < oldRollPulses) THEN FOR pulses = oldRollPulses TO newRollPulses - steps ' DEBUG "Pulses: ", DEC pulses, CR PULSOUT RollServo13, pulses PAUSE 20 NEXT oldRollPulses = newRollPulses DEBUG "5\r",CR
Comments
There's no terminal equivalent to NEXT, since all nesting is indicated with indentation.
-Phil
2) Spin uses included objects to provide functionality. Some are included with the Propeller Tool and others can be downloaded from the Propeller Object Exchange (see the link at the bottom of the main Parallax webpage). "Servo32v3" is included with the Propeller Tool and there's a demo program also included that illustrates its use. It takes care of all the servo pulse processing for you and works somewhat like the Parallax Servo Controller.
3) If you're doing much in the way of converting Stamp programs to the Propeller, look at the BS2_Functions object in the Object Exchange. It provides subroutines for much of the functionality of the Stamp's I/O statements.
thank you for your help and the prompt answer.
i take it.
regards
nomad