You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

17 lines
1.1 KiB

<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: <20><>ʾ<EFBFBD><CABE><EFBFBD>ε<EFBFBD><CEB5><EFBFBD>pwm<77><6D><EFBFBD><EFBFBD>ʵ<EFBFBD>ֶ<EFBFBD><D6B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ź<EFBFBD><C5BA><EFBFBD><EFBFBD><EFBFBD>
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ:
Usage: usage: ./sample_pwm PwmNum Freq DutyRatio
<EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD><EFBFBD>:
PwmNum<75><6D> pwm number;
Freq: pwmƵ<6D><C6B5>
DutyRatio<69><6F>pwmռ<6D>ձ<EFBFBD>(<28><>Χ<EFBFBD><CEA7>0-1000)
ע<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: 1.<2E><>ʹ<EFBFBD><CAB9>pwm<77><6D><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>ȷ<EFBFBD><C8B7>gpio<69>ܽŵķ<C5B5><C4B7><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD>.
2.<2E><><EFBFBD><EFBFBD>Ƶ<EFBFBD>ʺ<EFBFBD>ռ<EFBFBD>ձȿ<D5B1><C8BF>ܴ<EFBFBD><DCB4>ڲ<EFBFBD><DAB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>ͨ<EFBFBD><CDA8><EFBFBD>ӿڻ<D3BF>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5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