四博智联产品售后

标题: 脉冲宽度调制输出(PWM) [打印本页]

作者: ycf    时间: 2015-12-25 17:16
标题: 脉冲宽度调制输出(PWM)
  1. #define PIN_LED 16

  2. void setup() {
  3.   pinMode(PIN_LED, OUTPUT);
  4.   analogWrite(PIN_LED, 0);
  5. }

  6. void loop() {
  7.   for (int i = 0; i < 1024; i++)
  8.   {
  9.     analogWrite(PIN_LED, i);
  10.     delay(2);
  11.   }
  12.   for (int i = 1024; i >= 0; i--)
  13.   {
  14.     analogWrite(PIN_LED, i);
  15.     delay(2);
  16.   }
  17. }
复制代码







欢迎光临 四博智联产品售后 (http://115.29.109.104/) Powered by Discuz! X3.2