[CCC DEV] PWM MOTOR CONTROL
Laurence Laycock
rencio7 at gmail.com
Sat Aug 7 00:52:27 BST 2010
Hi guys...yeah I've been twiddling around...and I've figured out how to get
pwm motor control - well I don't think it probably is the best way to do it
but here is an example of a section of the code : -
*PROC main ()*
* CHAN SIGNAL s1:*
* CHAN SIGNAL s2:*
* CHAN BYTE b1:*
* CHAN BYTE b2:*
* PAR*
* heartbeat ()*
* pinSetup ()*
* goForward()*
* byte.tick (255, b1!) *
* pwm (enablePin, b1?)*
* byte.tick (50, b2!)*
* pwm (enablePin2, b2?)*
*
*
*
*
goForward() just tells the motor pins on the h bridge to go high or low.
byte.tick is in plumbing module here is the code: -
*PROC byte.tick (VAL BYTE input.value, CHAN BYTE out!)*
* WHILE TRUE*
* SEQ*
* out ! input.value*
*:*
The first value is the byte that will be sent to pwm through a channel
defined in the second.
I hope you like it as I am quite new to coding - I would like to know if
there is a better way to do this....
I really want to control my robot and get wheel encoders to work
(eventually) in concurrency.
Please advise
Laurence (:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.concurrency.cc/pipermail/developers/attachments/20100807/cf68cebe/attachment.htm>
More information about the developers
mailing list