VIM3 WiringPi GPIO OUPUT

Hello!
i‘m using Khadas WiringPi andVIM3.
i try use GPIODZ_15 OUTPUT ,as softpwm.but failed.
i try use GPIOH4 OUTPUT ,success.

my code

#include <stdio.h>

#include <wiringPi.h>

#include <softPwm.h>

const int PWMpin_L = 17;

const int PWMpin_R = 16;

int main()

{

if(-1 == wiringPiSetup())

{

    printf("set up error");

    exit(1);

}

softPwmCreate(PWMpin_L,0,100);

delay(1000);

softPwmCreate(PWMpin_R,0,100);

delay(1000);



while(1)

{

    softPwmWrite(PWMpin_L,33);

    delay(1000);

    softPwmWrite(PWMpin_R,33);

    printf("33%%\n");

    delay(5000);

    softPwmWrite(PWMpin_L,66);

    delay(1000);

    softPwmWrite(PWMpin_R,66);

    printf("66%%\n");

    delay(5000);

}

exit(0);

}

1 Like

@Yongchao,
似乎在电线 pi 网站, 有一个提到使用的东西称为 pThread 库, 你用过吗?
http://wiringpi.com/reference/software-pwm-library/

但是请稍候,该引脚(GPIO DZ_15)不支持软Pwm,只有硬件PWM引脚可以生成PWM信号,我相信您对softPwm感到困惑,因为您认为它可以在任何引脚上生成Pwm。 :grin:

@Yongchao GPIOZ_15 is a OD Pin , so you can’t use for softpwm.

1 Like

Exactly, only hardware PWM pins are capable to produce PWM with wiringpi softpwm library, right ?

OK,Thank you very much !

1 Like

Soft PWM means its generating PWM using software so no hardware is required…

@Frank adding a pull up will make it to work right…?

1 Like

Oh, I thought that only Hardware PWM pins could be used for PWM purpose, My bad, I am starting to confuse my technical terms :sweat_smile:

@Frank what is the meaning of “OD” in OD pin?

OD means open drain…

1 Like

Oh ok, didn’t know that

@Archangel1235 Yes ,you can do that , it will work . THis is a good idea