四博智联产品售后
标题:
脉冲宽度调制输出(PWM)
[打印本页]
作者:
ycf
时间:
2015-12-25 17:16
标题:
脉冲宽度调制输出(PWM)
#define PIN_LED 16
void setup() {
pinMode(PIN_LED, OUTPUT);
analogWrite(PIN_LED, 0);
}
void loop() {
for (int i = 0; i < 1024; i++)
{
analogWrite(PIN_LED, i);
delay(2);
}
for (int i = 1024; i >= 0; i--)
{
analogWrite(PIN_LED, i);
delay(2);
}
}
复制代码
欢迎光临 四博智联产品售后 (http://bbs.doit.am/)
Powered by Discuz! X3.2