• Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    Analog Output

    Scheduled Pinned Locked Moved Unipi 1 - HW Q&A
    5 Posts 1 Posters 4.3k Views 1 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S
      sabrus
      last edited by

      We bought the unipi this month.
      Now we are trying the functionality but we have a problem with Analog Output.
      We tried with pi4j (a java library for gpio) but don't work
      This is the code:
      public static void main(String[] args) throws InterruptedException {
      // initialize wiringPi library
      com.pi4j.wiringpi.Gpio.wiringPiSetup();
      // create soft-pwm pins (min=0 ; max=100)
      SoftPwm.softPwmCreate(1, 0, 100);
      // continuous loop
      while (true) {

      // fade LED to fully ON
      for (int i = 0; i <= 100; i++) {
      SoftPwm.softPwmWrite(1, i);
      Thread.sleep(25);
      }

      // fade LED to fully OFF
      for (int i = 100; i >= 0; i–) {
      SoftPwm.softPwmWrite(1, i);
      Thread.sleep(25);
      }
      }
      }

      the same code with a led on pin work correctly.
      We tried also with wiringpi (gpio pwm command) but on unipi don't work.
      The voltage on AO don't change, we just manage it using the blue trimmer.
      Can you help us?
      Many Thanks.

      1 Reply Last reply
      Reply Quote 0
      • S
        sabrus
        last edited by

        We bought the unipi this month.
        Now we are trying the functionality but we have a problem with Analog Output.
        We tried with pi4j (a java library for gpio) but don't work
        This is the code:
        public static void main(String[] args) throws InterruptedException {
        // initialize wiringPi library
        com.pi4j.wiringpi.Gpio.wiringPiSetup();
        // create soft-pwm pins (min=0 ; max=100)
        SoftPwm.softPwmCreate(1, 0, 100);
        // continuous loop
        while (true) {

        // fade LED to fully ON
        for (int i = 0; i <= 100; i++) {
        SoftPwm.softPwmWrite(1, i);
        Thread.sleep(25);
        }

        // fade LED to fully OFF
        for (int i = 100; i >= 0; i–) {
        SoftPwm.softPwmWrite(1, i);
        Thread.sleep(25);
        }
        }
        }

        the same code with a led on pin work correctly.
        We tried also with wiringpi (gpio pwm command) but on unipi don't work.
        The voltage on AO don't change, we just manage it using the blue trimmer.
        Can you help us?
        Many Thanks.

        1 Reply Last reply
        Reply Quote 0
        • ?
          Guest
          last edited by

          Hello,
          I am not much familiar with the wiring pi, but according to the softPwmCreate method, you gave it GPIO pin 1 but the AO pin is number 18. Next, do you have correctly wired the AO? Eg. if using the internal 12V power supply: 12V <-> AOV; AI1- <-> AOG ?

          Also we put out the opensource API available on github: https://github.com/UniPiTechnology/evok

          Best regards,
          Tomas

          1 Reply Last reply
          Reply Quote 0
          • S
            sabrus
            last edited by

            Hi,
            for wiring pi pin the pin number18 is the 1.
            Sorry but i don't understand why you use the AI1.
            We wired the AOV with external power and check the output on AO.

            1 Reply Last reply
            Reply Quote 0
            • ?
              Guest
              last edited by

              Hello, I have created a simple wiki page. See http://unipi.technology/wiki/Using_Analog_Output

              Let me know if anything is missing or not clear and I will fix it.

              1 Reply Last reply
              Reply Quote 0

              Hello! It looks like you're interested in this conversation, but you don't have an account yet.

              Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

              With your input, this post could be even better šŸ’—

              Register Login
              • First post
                Last post