On 7/24/13 7:16 AM, "Charles Goyard" cg@fsck.fr wrote:
J Oliver wrote:
So from your post, it seems quite straightforward to be able to access the GPIO pins from within Pd. But I need to be able to create variable voltages (between 0 and 5v) on those pins. In the post above, you mentioned that you send a float to the gpio object to write a value to the pin - would sending a 0.5 for example give me 2.5v on the pin? Or is it only on/off (0 or 5v)? If the former, I'm all set! If the latter, I'll need to figure out how to simulate a reduced voltage at the pin (likely using PWM or something but I'm not really sure how I would do that)
You can add a resistor and capacitor to build a RC filter, and you'll get a voltage out of pwm. You will have to experiment with different values to get something stable and fast enough.
See these pages for some information about that: http://jeelabs.org/2013/06/30/from-pwm-to-voltage/ http://dev.emcelettronica.com/how-to-use-pwm-to-generate-analog-or-analogu e-voltage-digital-circuits-part-2 http://sim.okawa-denshi.jp/en/PWMtool.php
As of 3.3V to 5V you can use a transistor before the RC filter.
Thank you, those links are very helpful!!
Dan Nigrin / Defective Records / http://defectiverecords.com CycliC, M185 & Klee Sequencers / MC-4 & MC-202 Hack / Audio Plugin Player / General MIDI Player / Major Malfunction Jack OS X / http://jackosx.com