Articles Posted in the " " Category

  • long

    long

    描述 Long (长整数) 是一个延伸储存空间的变数型别,它可以储存 32bits (4 bytes) 大小的整数,从 -2,147,483,648 到 2,147,483,647。 如果长整数要和整数做数学运算,必须在整数常数最后面加上 L,强制指定此整数为长整数。其他的细节请见 整数常数 的资料 范例 long speedOfLight = 186000L; // 详见整数常数页面中 ’L’ 的说明 语法 long var = val; var long 型别的变数名称 val 指派给变数的值 See also - byte - int - unsigned int - unsigned long - Integer Constants - Variable Declaration 语法参考主页面 本页由热血青年 LBU […]


  • word

    word

    描述 字元储存 16-bit 的无号数,范围从 0 到 65535。相当于 unsigned short 型别。 范例 word w = 10000; See also - byte - word() 语法参考主页面 本页由热血青年 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 […]


  • unsigned int

    unsigned int

    描述 在 86Duino 上无号整数和有号整数一样,都储存在 4 byte (32 bits) 的空间,因为不能储存负数,因此储存正整数的范围扩大为 0 到 4,294,967,295 (2^32 – 1)。 有号数与无号数之间的差别在于最高位元,在有号数的时候他会被解释成正负号的位元,86Duino 中,有号数的最高位元是 1 时,该数值为负数,其他位元将会用 2的补数 表示。 范例 unsigned int ledPin = 13; 语法 unsigned int var = val; var 无号数的变数名称 val 指派数值给变数 提醒 当变数超过他们的最大值时,会回卷到最小值再加上去,相反的亦是如此。 See also - byte - int - long - unsigned long - Variable Declaration 语法参考主页面 本页由热血青年 […]


  • int

    int

    描述 整数型别是储存一个数字的主要资料型别。 在 86Duino 上一个 int 能储存 32-bit (4-byte) 的数值,范围在 -2,147,483,648 到 2,147,483,647 之间 (最小值是 -(2^31) 而最大值是 (2^31)-1)。 int 储存负整数是以二的补数计算方法来运算,最高位元称为 ”sign”,用来表示是负数与否,1 即是负整数,0 则是正整数。 在 86Duino 上,你可以放心的在运算式中使用负数;但请注意:在处理 位元右移运算 时,有可能会出现不可预期的副作用。 范例 int ledPin = 13; 语法 int var = val; var 整数变数名称 val 指派数值给变数 提醒 当变数超过他们可表示的最大范围时,会返回最小后再加上去,反之亦是如此。例如一个 32-bit 的整数: See also - byte - unsigned int - long […]


  • 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 […]