PWM outputs not working in IDE 2.1.0-win

Home Forums Drona Aviation – Drone for Education PWM outputs not working in IDE 2.1.0-win

Viewing 1 reply thread
  • Author
    Posts
    • #4258
      sealteam1272
      Participant

        Hi,

        We need to drive servos with the GPIO of the primusx board, but we can’t get the pwm outputs to work when using IDE 2.1.0 (win). When we use the following code, the output is stuck high or low, but it is never a PWM signal. It doesn’t matter what output we choose, and we get the same result on both our primusx boards.

        #include “PlutoPilot.h”
        #include “Peripheral.h”

        void plutoInit()
        {
        }

        void onLoopStart()
        {
        PWM.init(Pin3, 500);
        }

        void plutoLoop()
        {
        PWM.write(Pin3, 1000);
        }

        void onLoopFinish()
        {
        }

        However using IDE 1.0.6-win we can get a PWM output to work on pin2 of the GPIO (on both boards). The code using this older IDE looks like this:

        #include “PlutoPilot.h”
        #include “Servo.h”

        void plutoInit()
        {
        }

        int servoAngle = 1000;

        void onPilotStart()
        {
        }

        void plutoPilot()
        {
        Servo.set(S1, servoAngle);
        // toggle pulse width between values 1000 and 2000
        if (servoAngle == 1000)
        servoAngle = 2000;
        else if (servoAngle == 2000)
        servoAngle = 1000;
        }

        void onPilotFinish()
        {
        }

        This code works fine. Any thoughts on what is going on?

      • #4260
        Keval Ajmeri
        Participant

          Hi, there seems to be an issue on the software end currently for Pin3. You can try the same code for Pin2 or Pin10. That should work fine.

      Viewing 1 reply thread
      • You must be logged in to reply to this topic.