Help with pulse width modulation
atomicrockerdude
Posts: 1
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
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
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.
IF Sum > 4900 THEN
Sum = Sum - Delta
Are you sure that this sw is complete?