Shop OBEX P1 Docs P2 Docs Learn Events
Help with pulse width modulation — Parallax Forums

Help with pulse width modulation

atomicrockerdudeatomicrockerdude Posts: 1
edited 2012-04-06 12:11 in BASIC Stamp
Im trying to code up a pulse width modulation program in PBASIC and I'm having trouble with it. All I need it to do is to vary the speed of a motor based on how close something is to a ping sensor.

The code I used for the ping sensor works. However, my code I used for the pulse with modulation does not work.

I attached the file (sigmadelta) with the code in it above. If anyone could point out what is wrong with my program or modify it to get it working that would be totally awesome.

In addition I attached the attached the ping sensor code also.

Sigma-Delta.bs2Untitled1.bs2

Comments

  • FranciscoTavaresFranciscoTavares Posts: 27
    edited 2012-04-06 12:07
    According to PBASIC manual :
    The POLLOUT command is one of a family of unique "polling" commands on the BS2p, BS2pe, and BS2px modules
    You are using BS2 module.' {$STAMP BS2}
    ' {$PBASIC 2.5}

    I have a Boe-Bot with a ping sensor and a BS2p module. I´ll try to run this sw and see the results.



    Im trying to code up a pulse width modulation program in PBASIC and I'm having trouble with it. All I need it to do is to vary the speed of a motor based on how close something is to a ping sensor.

    The code I used for the ping sensor works. However, my code I used for the pulse with modulation does not work.

    I attached the file (sigmadelta) with the code in it above. If anyone could point out what is wrong with my program or modify it to get it working that would be totally awesome.

    In addition I attached the attached the ping sensor code also.

    Sigma-Delta.bs2Untitled1.bs2
  • FranciscoTavaresFranciscoTavares Posts: 27
    edited 2012-04-06 12:11
    PBASIC says that there is no symbol Delta
    IF Sum > 4900 THEN
    Sum = Sum - Delta

    Are you sure that this sw is complete?
    Im trying to code up a pulse width modulation program in PBASIC and I'm having trouble with it. All I need it to do is to vary the speed of a motor based on how close something is to a ping sensor.
    in
    The code I used for the ping sensor works. However, my code I used for the pulse with modulation does not work.

    I attached the file (sigmadelta) with the code in it above. If anyone could point out what is wrong with my program or modify it to get it working that would be totally awesome.

    In addition I attached the attached the ping sensor code also.

    Sigma-Delta.bs2Untitled1.bs2
Sign In or Register to comment.