Articles Posted by the Author:

  • charAt()

    charAt()

    描述 找到字串中指定位置的字元。 语法 string.charAt(n) 参数 string: String 物件 (字串) n: 指定的位置 回传 字串中第 n 个位置所在的字元 。 See also - String - setCharAt() - [] (element access) 语法参考主页面 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 […]


  • String()

    String()

    描述 建构一个 String 类别的实例。建构 String 时有多种型态,例如:不同的资料型别,包括以下: 用双引号包起来的字串常数 用单引号包起来的字元常数 其它 String 物件 一个整数 (int 型别) 常数或长整数 (long 型别) 常数 一个整数 (int 型别) 常数或长整数 (long 型别) 常数,并使用指定的进位表示法 (例如:二进制、八进制、十进制等等) 一个整数 (int 型别) 变数或长整数 (long 型别) 变数 一个整数 (int 型别) 变数或长整数 (long 型别) 变数,并使用指定的进位表示法 (例如:二进制、八进制、十进制等等) 用来表示数字的字串,预设是以十进位来表示,例如: String thisString = String(13) 你会得到字串 13。另外,你也可以使用其它进位表示法,例如: String thisString = String(13, HEX) 你会得到字串 D,它是用十六进制来表示十进制的数字 […]


  • 函式宣告

    函式宣告

    将程式码分割成多个函式区块可以让程式设计师更容易将程式码模组化,程式设计师可以将任务还有回传值定义在一个函式区块中,再让其他程式来 ”呼叫” 它们。传统的用法是,当在程式码内需要多次某种相同动作时就创建一个函式。 给习惯用 BASIC 的程式设计师,在 86Duino 中的函式提供 (还有扩充) 了一些子程式 (BASIC 中的 GOSUB)。 将程式码分割成函式具有下列几个优点: 函式让程式码本身更具组织性,也让程式码变的较概念化。 函式让一个动作被撰写在一个地方,所以这个函式只需要思考与除错一次就可以了。 这也减少在修改程式码过程中发生错误的机率。 函式让整个程式码变的比较小且紧密,因为再利用率变高了。 这样让再次利用别的程式码变得更容易也更模组化,副作用更少,还有可读性变更好。 setup() 与 loop() 是 Aruino 及 86Duino 必备的两个函式,其他的函式必须创建在这两个函式之外。举个例子,我们建立一个简单的函式去将两个数字相乘。 范例 “呼叫” 一个简单的乘法函式,我们传给它预想中的资料形态参数: 函式需要被宣告在任何的函式之外,因此 “myMultiplyFunction()” 要被宣告在 ”loop()” 上面或者下面。 整个程式码会像这样: 其他范例 这个函式会藉由 analogRead() 读取一个感测器五次并且计算五次读取值的平均。它把资料限制在 8 bit 之中 (0 到 255),并回传计算后的结果。 呼叫我们的函式只需要指派一个变数给它。 语法参考主页面 本页由热血青年 LBU 译自英文版。 The text of the […]



  • double()

    double()

    描述 将一个值转换成 double 的资料型别。 语法 double(x) 参数 x: 任何型别的值 回传 double See also - double 语法参考主页面 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.


  • long double

    long double

    描述 86Duino 中支援 80-bit 扩展精度 (double extended) 的浮点数型别 long double,double extended 格式的表示范围从 3.65E−4951 到 1.18E+4932,虽然它并不是被设计用来精确的储存资料,不过它能减少浮点数在运算时的溢位以及舍入误差,进而提升浮点运算的精确度,更多的详细资料请参考 x86 扩展精度格式。 范例 long double myVar; long double sensorCalbrate = 1.117; 语法 long double var = val; var 变数名称 val 指派给变数的值 语法参考主页面 本页由热血青年 LBU 译自英文版。 The text of the 86Duino reference is a modification of the Arduino reference, and is […]


  • parseFloat()

    parseFloat()

    描述 parseFloat() 可以回傳串流中第一個可用的浮點數。若檢測到非符點數的字元時 parseFloat() 就會終止。 這個函式是 Stream 類別的一部分,它可以被任何繼承它的類別呼叫 (例如:Wire、Serial 等等) 。 語法 stream.parseFloat() 參數 stream : 一個類別的實例,這個類別是繼承於 Stream 回傳 浮點數 (float 型別) See also - Stream 語法參考主頁面 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 […]


  • parseInt()

    parseInt()

    描述 parseInt() 可以回传从串流中读到的第一个整数。假如检测到字元不是数字 parseInt() 就会终止。 这个函式是 Stream 类别的一部分,它可以被任何继承它的类别呼叫 (例如:Wire、Serial 等等) 。 语法 stream.parseInt() 参数 stream : 一个类别的实例,这个类别是继承于 Stream 回传 整数 (int 型别) See also - Stream 语法参考主页面 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 […]


  • readStringUntil()

    readStringUntil()

    描述 readStringUntil() 可以从串流中读取字元,然后储存成字串后回传。这个函式会在收到结尾字元,或者指定时间内没收到任何值后停止 (时间的设定可参考 setTimeout())。 这个函式是 Stream 类别的一部分,它可以被任何继承它的类别呼叫 (例如:Wire、Serial 等等) 。 语法 stream.readString(terminator) 参数 stream : 一个类别的实例,这个类别是继承于 Stream terminator : 结尾字元 (char 型别) 回传 从串流读到的字串,直到指定的结尾字元。 See also - Stream 语法参考主页面 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 […]


  • readString()

    readString()

    描述 readString() 可以从串流中读取字元,然后储存成字串后回传。这个函式会在指定时间內没收到任何值后停止 (时间的设定可参考 setTimeout())。 这个函式是 Stream 类别的一部分,它可以被任何继承它的类别呼叫 (例如:Wire、Serial 等等) 。 语法 stream.readString() 参数 stream : 一个类别的实例,这个类别是继承于 Stream 回传 从串流读到的字串 See also - Stream 语法参考主页面 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 […]