beagleboard / bonescript

Scripting tools for the BeagleBoard and BeagleBone
http://beagleboard.org
MIT License
32 stars 9 forks source link

disable pwm output #26

Open jadonk opened 6 years ago

jadonk commented 6 years ago

From @colinbes on June 4, 2014 19:7

I am running bonescript 0.2.4 on latest debian image on bbb.

I have two PWM outputs; P9_22 and P9_42

After a period I need to shutdown pwm outputs (take them to low). As their is no function exposed to write a zero (0) to 'run' I have used recommendation to write a zero to dutycycle in analogWrite, for simple code example see:

var b = require('bonescript');
var pulseOutput = "P9_42";
b.analogWrite(pulseOutput, 0.5, 2000)
setTimeout(function(){
    b.analogWrite(pulseOutput, 0)
    }, 10000);

P9_42 output pin goes low as expected, but P9_22 doesn't - it has a 10nS spike every 500uS.

Manually writing zero to echo 0 > /sys/devices/ocp.3/bs_pwm_test_P9_22.16/run does work.

Any ideas/suggestions?

Would it be possible to expose disable/enable function in upcoming release?

Thanks Colin

Copied from original issue: jadonk/bonescript#88

jadonk commented 6 years ago

From @colinbes on July 29, 2014 12:34

I was wondering if there was any feedback on this issue as I really need to shutdown the PWM output such that output is at a steady 0V?

jadonk commented 6 years ago

From @adityapatadia on September 15, 2014 8:4

Try https://github.com/theoctal/octalbonescript It is fork of bonescript with a lot of improvements. And guess what? It has stopAnalog(pin, callback) function for your need. Test it and let us know.

jadonk commented 6 years ago

From @colinbes on September 15, 2014 16:57

Thanks, I will take a look and let you know.

~C