查看: 3006|回复: 3

[求助] 不再让CHipKIT Uno32寂寞 ——流水灯

[复制链接]

该用户从未签到

发表于 2012-8-8 15:31:36 | 显示全部楼层 |阅读模式
分享到:
原帖由
A670521546
发自:dev.eefocus.com
------------------------------------------------------------------------------------------------------------------------------------------
都这么长时间了。开始学习起来,不要再空着板子了,不然板子会寂寞的

先从最简单的流水灯来吧
1.jpg

2.jpg

3.jpg
代码这个很简单:
void setup() {               
  // initialize the digital pin as an output.
  pinMode(5, OUTPUT);
  pinMode(6, OUTPUT);
  pinMode(7, OUTPUT);
  pinMode(8, OUTPUT);
  pinMode(9, OUTPUT);
  pinMode(10, OUTPUT);
  pinMode(11, OUTPUT);
  pinMode(12, OUTPUT);
}

void loop() {
  while(1){
  digitalWrite(5, HIGH);   // set the LED on
  delay(1000);              // wait for a second
  digitalWrite(5, LOW);    // set the LED off
  delay(1000);              // wait for a second
  digitalWrite(6, HIGH);   // set the LED on
  delay(1000);              // wait for a second
  digitalWrite(6, LOW);    // set the LED off
  delay(1000);              // wait for a second
  digitalWrite(7, HIGH);   // set the LED on
  delay(1000);              // wait for a second
  digitalWrite(7, LOW);    // set the LED off
  delay(1000);              // wait for a second
  digitalWrite(8, HIGH);   // set the LED on
  delay(1000);              // wait for a second
  digitalWrite(8, LOW);    // set the LED off
  delay(1000);              // wait for a second
  digitalWrite(9, HIGH);   // set the LED on
  delay(1000);              // wait for a second
  digitalWrite(9, LOW);    // set the LED off
  delay(1000);              // wait for a second
  digitalWrite(10, HIGH);   // set the LED on
  delay(1000);              // wait for a second
  digitalWrite(10, LOW);    // set the LED off
  delay(1000);              // wait for a second
  digitalWrite(11, HIGH);   // set the LED on
  delay(1000);              // wait for a second
  digitalWrite(11, LOW);    // set the LED off
  delay(1000);              // wait for a second
  digitalWrite(12, HIGH);   // set the LED on
  delay(1000);              // wait for a second
  digitalWrite(12, LOW);    // set the LED off
  delay(1000);              // wait for a second
  }
}

回复

使用道具 举报

  • TA的每日心情
    难过
    2015-7-11 15:23
  • 签到天数: 567 天

    连续签到: 1 天

    [LV.9]以坛为家II

    发表于 2012-9-8 09:14:04 | 显示全部楼层
    转转,看看…………
    回复 支持 反对

    使用道具 举报

  • TA的每日心情
    奋斗
    2017-5-12 10:32
  • 签到天数: 295 天

    连续签到: 1 天

    [LV.8]以坛为家I

    发表于 2014-1-2 22:32:05 | 显示全部楼层
    定义个~~~~~~~~~~~~~~~·
    回复 支持 反对

    使用道具 举报

  • TA的每日心情
    开心
    2023-1-28 16:20
  • 签到天数: 980 天

    连续签到: 1 天

    [LV.10]以坛为家III

    发表于 2018-8-27 17:32:12 | 显示全部楼层
    不错  支持
    回复 支持 反对

    使用道具 举报

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

    本版积分规则

    关闭

    站长推荐上一条 /2 下一条

    手机版|小黑屋|与非网

    GMT+8, 2024-3-29 13:08 , Processed in 0.140666 second(s), 21 queries , MemCache On.

    ICP经营许可证 苏B2-20140176  苏ICP备14012660号-2   苏州灵动帧格网络科技有限公司 版权所有.

    苏公网安备 32059002001037号

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.