极客工坊

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 11478|回复: 0

流水灯

[复制链接]
发表于 2015-6-21 14:56:18 | 显示全部楼层 |阅读模式
void setup()
{
  for (int i=2;i<=12;i++)
  {pinMode(i,OUTPUT);}//初始化,设置相应引脚为输出模式
}
void loop()
{
for(int a=0;a<=13;a++)//循环点亮LED
{
digitalWrite(a,HIGH);
delay(100);//每个LED间隔300毫秒
}
for(int b=13;b>=0;b--)//循环灭掉LED
{
digitalWrite(b,LOW);
delay(100);//间隔300毫秒
}
}
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|联系我们|极客工坊

GMT+8, 2026-6-17 07:40 , Processed in 0.107586 second(s), 17 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表