zoukankan      html  css  js  c++  java
  • 第5章 Arduino IDE编程语言参考

    第5章 Arduino IDE编程语言参考

    一、Arduino IDE内置了编程语言参考,可以作为学习参考

    二、系统提供的语言参考分为三个方面

    1. 结构Structure;
    2. 变量Variables;
    3. 函数Functions;

    三、程序举例:我们可以参考程序提供的内置示例程序

     

    练习读程序!

    const int buttonPin = 2;     // the number of the pushbutton pin

    const int ledPin =  13;      // the number of the LED pin

    // variables will change:

    int buttonState = 0;         // variable for reading the pushbutton status

    void setup() {

      // initialize the LED pin as an output:

      pinMode(ledPin, OUTPUT);

      // initialize the pushbutton pin as an input:

      pinMode(buttonPin, INPUT);

    }

    void loop() {

      // read the state of the pushbutton value:

      buttonState = digitalRead(buttonPin);

      // check if the pushbutton is pressed. If it is, the buttonState is HIGH:

      if (buttonState == HIGH) {

        // turn LED on:

        digitalWrite(ledPin, HIGH);

      } else {

        // turn LED off:

        digitalWrite(ledPin, LOW);

      }

    }

    四、想和计算机进行交流,在Arduino开源平台上,展示创意,必须掌握的基本语法规则。

    1. 两个主函数setup(),loop()。
    2. 每句程序末尾加分号。
    3. 区分大小写。
    4. 区分全角半角。
    5. 函数和变量名以字母或下划线开头。
    6. 系统的关键字不能被用于其他途径。
    7. 最好每个语句都加上注释,这是一个良好的编程习惯、
    开发计算机创智课程的实践研究
  • 相关阅读:
    PL/SQL Developer使用技巧、快捷键(转发)
    Java 获取随机日期
    jsonArray和Java List对象互转,日期处理
    ExtJs grid单选,多选
    ExtJs 下拉单联动,次级下拉框查询模式
    ExtJs 日期相加,Grid表格列可编辑
    转:Java阳历转农历
    转:Java 计算2个时间相差多少年,多少个月,多少天的几种方式
    钥匙计数之一
    LianLianKan
  • 原文地址:https://www.cnblogs.com/ztg1/p/12554668.html
Copyright © 2011-2022 走看看