6 Replies Latest reply on Jan 7, 2015 8:09 PM by KurtE

    Getting PWM input with mini breakout board?

    evanbooth

      Hey,

       

      I'm pulling my hair out trying to read a PWM value from a pot. Here's a few details:

      - MRAA Version: v0.5.4-46-g74d172c

      - Using Node.JS via the XDK

      - The 5v signal dims an LED as expected, so I know the pot is "working"

      - I'm running everything through a bi-directional level shifter (1.8v output and gnd are coming off the edison mini breakout)

       

      Here's my code:

      var mraa = require('mraa');
      var pwm1 = new mraa.Pwm(0, -1, true); // this is J17-1 on the BOB. I've tried setting the third argument to false as well.
      pwm1.enable(true);
      
      setInterval(function(){
          console.log(pwm1.read());
      });
      
      

       

      Results: Always zero. Always.

       

      Things I've tried:

      - Running the signal into an Arduino Leo (reads in 0-1024, as expected)

      - Running the signal through the level shifter, then immediately back through another channel (5v —> 1.8v —> 5v), then to the Arduino... just to make sure the level shifter is working properly.

      - Using that pin (J17-1) as digital IO just to make sure it isn't damaged (works fine... DMM reads ~1.8v)

      - Testing to make sure that pin is capable of reading PWM with the following:

      mraa.pinTestMode(0, 2); // TRUE
      
      

       

       

      Thanks for looking at this! Any ideas?