9 Replies Latest reply on Mar 2, 2017 4:03 PM by KitTech

    calling mraa::Gpio "direction" effecting the output signal (Arduino Breakout)

    KitTech

      Everytime I call mraa::Gpio "direction" method the output signal is not stable.  Is this normal?  I create the code to test.  The code should give the steady rectangle pulse, however the actual output is distort.

       

      #include <mraa.hpp>

       

      int main(void) {

        mraa::Gpio *test;

        test=new mraa::Gpio(7,true,false);

        if (test==NULL) exit(mraa::ERROR_UNSPECIFIED);

       

        if (test->dir(mraa::DIR_OUT)!=mraa::SUCCESS) exit(0);

        test->mode(mraa::MODE_HIZ);

        while(1) {

          if (test->dir(mraa::DIR_OUT)!=mraa::SUCCESS) exit(0);

          test->write(0);

          if (test->dir(mraa::DIR_OUT)!=mraa::SUCCESS) exit(0);

          test->write(1);

          usleep(10000L);

          }

        }