Articles Posted by the Author:

  • byte

    byte

    描述 一个 byte 可以储存 8-bit 的无号数,范围为 0 到 255。 范例 byte b = B10010; // "B" 代表二进制符号 (B10010 = 十进制的数字18) See also - word - byte() - Variable Declaration 语法参考主页面 本页由热血青年 LBU 译自英文版。 The text of the 86Duino reference is a modification of the Arduino reference, and is licensed under a Creative Commons Attribution-ShareAlike 3.0 […]


  • unsigned char

    unsigned char

    描述 该型别为占用 1 个位元组记忆体的无符号资料型别,与 byte 资料型别雷同,unsigned char 的编码范围为 0 到 255,为了一致性 86Duino 的程式码撰写风格会更倾向于使用 byte 资料型别。 范例 unsigned char myChar = 240; See also - byte - int - array - Serial.println 语法参考主页面 本页由热血青年 LBU 译自英文版。 The text of the 86Duino reference is a modification of the Arduino reference, and is licensed under a Creative Commons […]


  • char

    char

    描述 资料型别 char 占用 1 个位元组的记忆体空间储存一个字符值,将文字写在单引号之中表示为字符,像是 ’A’ (若是多个字符则称为字串并改用双引号: ”ABC”)。 字元透过编码成数字后以其数值储存起来,字符的编码方式请参见 ASCII 表,这代表使用字符的 ASCII 码可以进行算术处理(例如 ’A’+1 的数值为 66,因为大写字母 A 的 ASCII 码是 65),关于更多的字元如何转换为数字的资讯请参考 Serial.println。 char 是一个带有正负号的资料型别,这表示它的编码范围是从 -128 到 127,若是无符号的型别则为 1 个位元组大小 (8位元) 的资料型别。 范例 See also - byte - int - array - Serial.println 语法参考主页面 本页由热血青年 LBU 译自英文版。 The text of the 86Duino reference is a […]


  • boolean

    boolean

    boolean 布林变数只有两种数值,true 或 false。 范例 See also - constants - boolean operators - Variable Declaration 语法参考主页面 本页由热血青年 LBU 译自英文版。 The text of the 86Duino reference is a modification of the Arduino reference, and is licensed under a Creative Commons Attribution-ShareAlike 3.0 License. Code samples in the reference are released into the public domain.


  • void

    void

    void 型别用于函式宣告,表示函式的回传值是无内容的。 范例 See also - function declaration 语法参考主页面 本页由热血青年 LBU 译自英文版。 The text of the 86Duino reference is a modification of the Arduino reference, and is licensed under a Creative Commons Attribution-ShareAlike 3.0 License. Code samples in the reference are released into the public domain.


  • 浮点常量

    浮点常量

    类似于整数常数,使用浮点数常数亦可增加程式码的可读性,在编译程式时,编译器会自动将浮点数常数转换成可用于运算的数值。 范例: n = .005; 浮点数常数可以被表示为科学记号 E 或者 e,即指数表示法。 浮点数常数 等于 又等于 10.0 10 2.34E5 2.34 * 10^5 234000 67e-12 67.0 * 10^-12 .000000000067 语法参考主页面 本页由热血青年 LBU 译自英文版。 The text of the 86Duino reference is a modification of the Arduino reference, and is licensed under a Creative Commons Attribution-ShareAlike 3.0 License. Code samples in the […]


  • 整数常量

    整数常量

    整数常数是可以在草稿码中直接使用的数字,像是 123;预设这些数字会被当做 int 资料型别,但是你可以将其更改为 U 和 L 型别 (在后面的说明中会提到)。 一般来说,整数常数前面若没有标示特别的符号,将被视为十进制整数。 进制 范例 格式 备注 10 (decimal) 123 无 2 (binary) B1111011 开头为 B 只能使用8位元 (0 到 255) 有效字元只有 0 跟 1 8 (octal) 0173 开头为 0 有效字元只有 0 到 7 16 (hexadecimal) 0x7B 开头为 0x 有效字元 0 到 9、A 到 F、a 到 f   Decimal […]


  • 常量定义 (constants)

    常量定义 (constants)

    常数在 86Duino 语言中是预先被定义好的变数,它们让程式码变得更容易阅读。 定义逻辑上的 true 和 false (布林常数) 86Duino 语言中有两个常数用来表示 真 或 假:true 以及 false false 在两者之中,false 较容易定义,它只要被定义为 0 即可。 true 通常 true 会被定义为 1 以表示 真,但事实上 true 拥有许多广泛的定义,任意一个非零的整数都可以为 true,所以 -1、2、-200,在布林逻辑上都会被定义为 true。 注意 true 或 false 是小写的,而不像 HIGH、LOW、INPUT、OUTPUT。 定义 pin 脚状态上的 HIGH 和 LOW 当读取或者写入GPIO pin 脚时只有两种设定值:HIGH 与 LOW。 HIGH HIGH 对于一个 pin 脚的意义,会根据其设定为 INPUT […]


  • 复合位元OR运算 (|=)

    复合位元OR运算 (|=)

    描述 复合位元运算 OR 运算子 (|=) 常用在配合常数 ”设置” 变数内特定的位元至 1。 语法 x |= y; // 等同于 x = x | y; 参数 x: 字元,整数或长整数型别变数。 y: 字元,整数或长整数型别变数。 范例 首先,复习位元运算子 OR(|)          0 0 1 1    运算子1          0 1 0 1    运算子2                   0 1 1 1    (运算子1 | 运算子2)       回传结果 […]


  • 复合位元AND运算 (&=)

    复合位元AND运算 (&=)

    描述 复合位元运算 AND 运算子 (&=) 常用在配合常数变换变数内特定的位元成 LOW 状态(变成 0),在程式撰写上又称为 ”清除” 或者 ”重置”。 语法 x &= y; // 等同于 x = x & y; 参数 x: 一个字元/整数/长整数型别变数 y: 一个字元/整数/长整数型别常数 范例 首先,复习位元运算 AND(&) 运算子          0 0 1 1    运算元1          0 1 0 1    运算元2                   0 0 0 1    (运算元1 & […]