[CCC DEV] PWM MOTOR CONTROL

Michael Pirrone-Brusse pirronm at allegheny.edu
Sat Aug 7 05:40:24 BST 2010


Hey Laurence,
    About the seeeduinomega configs not working.... I'm really not sure why
it's not happening yet. I have all of the symbolic constants one would need
for that board to work, there's just... Something not working. The
arudinomega is working though, and that's close enough for most everything.

    I've set up a drop at
      http://drop.io/plumbingOccamDoc
     so you can head there and download that (it's been zipped), and look
for index.html to get started.

    And yeah. Good times all around. Keep in touch,
        -Drew

On Fri, Aug 6, 2010 at 11:41 PM, Laurence Laycock <rencio7 at gmail.com> wrote:

> Wow thanks for the reply :D I can say my robot is moving in a straight line
> now due to pwm!
> Yeh the OccamDocs would be a great help.
> I'm really enjoying trying to figure out concurrency code libraries -
> believe me I have a lot of questions!
> I might be dreaming about the capabilities of plumbing on the arduino....or
> not :D
> Anyway it's starting to feel a lot more natural.
> It's really exciting stuff. I'm addicted lol.
>  I was trying to configure pwm PROC to my motor control needs by changing
> clamp.byte but to no avail :(
> Oh yes I've made some posts about Seeeduino mega compatibility or lack of
> and changing the conf files - PLATFORM=seeedmega to PLATFORM=seeeduinomega
> and this (maybe) fixing? compiling in the user section btw...
>
> Laurence (:
>
>
> On 7 August 2010 04:25, Michael Pirrone-Brusse <pirronm at allegheny.edu>wrote:
>
>> Hey Laurence,
>>     So, this is a bit exciting for me as I wasn't really sure the
>> use-cases of the pwm(..) and servo(..) protocols when I wrote them, so..
>> ::rubs hands together::
>>
>>     Just by glancing at your code I can't say if what you're doing is
>> exactly right for motor control -- I've only tested pwm on fading LEDs, and
>> servos. No motors handy -- but you're really close to (what I'm guessing)
>> you want.
>>     The one big thing you're doing that you *shouldn't* need to
>> (emphasized because, well... yeah) is the whole byte.tick PROC. The pwm PROC
>> actually just sets a few registers on the ATmega that tells it to constantly
>> pulse the pin given at the frequency given, and then it should keep pulsing
>> until the board looses power. By telling it to pulse at 255 as quickly as
>> possible, you shouldn't actually be changing the behavior of the PWM. The
>> CHAN BYTE pwm(..) takes is for changing the pulse width as your program
>> runs.
>>
>>     I think we were planning on putting these online pretty soon anyway,
>> but if you'd like, I could share the OccamDocs (JavaDoc style, html
>> documentation for Occam code) for the plumbing libraries. I'm not sure how
>> much they would help, but you'd certainly help me figure that out. XD
>>
>>     Let us know how things go,
>>         -Drew Pirrone-Brusse
>>
>> On Fri, Aug 6, 2010 at 7:52 PM, Laurence Laycock <rencio7 at gmail.com>wrote:
>>
>>> 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 (:
>>>
>>> _______________________________________________
>>> developers mailing list
>>> developers at concurrency.cc
>>> http://unhosting.org/mailman/listinfo/developers
>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.concurrency.cc/pipermail/developers/attachments/20100807/c381f92f/attachment.htm>


More information about the developers mailing list