标题: arduino呼吸灯 [打印本页]

作者: vuvi    时间: 2019-5-29 08:38
标题: arduino呼吸灯
void setup() {
  // put your setup code here, to run once:
pinMode(10,OUTPUT);
}

void loop() {
  // put your main code here, to run repeatedly:
for(int i=0,t=1;i<=255,i>=0;i=i+t){
  analogWrite(10,i);
  delay(8);
  if(i==255)
  t=-t;
  delay(8);
  }

}





欢迎光临 (http://www.51hei.com/bbs/) Powered by Discuz! X3.1