zoukankan      html  css  js  c++  java
  • 1个LED灯闪烁的Arduino控制

    控制任务和要求

    让一个LED灯闪烁

    接线  

    程序设计

     1 int half_cycle=1000;   // define the cycle time of LED blink
     2 int LED_pin=13;      // define the LED pin
     3 
     4 // the setup function runs once when you press reset or power the board
     5 void setup() 
     6 {
     7   pinMode(LED_pin, OUTPUT);    // initialize digital pin 13 as an output.
     8 }
     9 
    10 // the loop function runs over and over again forever
    11 void loop() 
    12 {
    13   digitalWrite(LED_pin, HIGH);     // turn the LED on (HIGH is the voltage level)
    14   delay(half_cycle);              // wait for half_cycle time
    15   digitalWrite(LED_pin, LOW);     // turn the LED off by making the voltage LOW
    16   delay(half_cycle);              // wait for half_cycle time
    17 }

    注解

    改变LED_pin的值可以改变LED的联接引脚,改变half_cycle的值可以改变闪烁周期。

  • 相关阅读:
    xlrd模块
    魔法路由ViewSetMixin
    AES加密
    orm的增删改查
    引入方式+样式+选择器
    视图+sql注入+事务+存储过程
    mysql用户管理+pymysql模块
    记录的详细操作
    约束
    一次http请求参数问题
  • 原文地址:https://www.cnblogs.com/MyAutomation/p/9279212.html
Copyright © 2011-2022 走看看