jimmyyjlee 发表于 2013-10-22 10:36:56

請問如何得到和Bath NL & CR一樣的效果?

本帖最后由 jimmyyjlee 于 2013-10-22 10:39 编辑

當我開啟Both NL & CR時輸入AT按下send,可以得到ok的回覆

想請問各位大俠,當我no line ending時,要在AT後輸入什麼可以得到和Both NL & CR一樣的結果?


謝謝

隨風大俠 发表于 2013-10-23 08:59:18

輸入:AT\r\n
\r是歸位字元
\n是換行字元

jimmyyjlee 发表于 2013-10-23 10:13:21

TTTTTTT33 发表于 2013-10-23 08:59 static/image/common/back.gif
輸入:AT\r\n
\r是歸位字元
\n是換行字元

謝謝您
我的是apple 作業系統 mac os 10.8.5
輸入您的方式但沒效
結果如下,您試過是成功的嗎?
http://sensor.free.sahost.cc/image/ch1.png

隨風大俠 发表于 2013-10-23 10:21:08

jimmyyjlee 发表于 2013-10-23 10:13 static/image/common/back.gif
謝謝您
我的是apple 作業系統 mac os 10.8.5
輸入您的方式但沒效


不是得到ok了嗎??

histamine 发表于 2013-10-23 10:45:47

本帖最后由 histamine 于 2013-10-23 10:47 编辑

arduino ide的串口工具不支持输入框里的 \ 转义字符
具体请看代码
https://github.com/arduino/Arduino/blob/master/app/src/processing/app/SerialMonitor.java
    sendButton = new JButton(_("Send"));
    sendButton.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
      send(textField.getText());
      textField.setText("");
      }});



private void send(String s) {
    if (serial != null) {
      switch (lineEndings.getSelectedIndex()) {
      case 1: s += "\n"; break;
      case 2: s += "\r"; break;
      case 3: s += "\r\n"; break;
      }
      serial.write(s);
    }
}LZ的情况必须要开启Both NL & CR才行

jimmyyjlee 发表于 2013-10-23 11:01:04

TTTTTTT33 发表于 2013-10-23 10:21 static/image/common/back.gif
不是得到ok了嗎??

您好
謝謝回覆

在Both NL& CR模式下輸入AT然後按下send即可得到回覆ok
http://sensor.free.sahost.cc/image/cn2.png
我的問題是在no line ending模式下AT之後要輸入什麼才能到回覆ok呢

jimmyyjlee 发表于 2013-10-23 12:18:47

histamine 发表于 2013-10-23 10:45 static/image/common/back.gif
arduino ide的串口工具不支持输入框里的 \ 转义字符
具体请看代码
https://github.com/arduino/Arduino/b ...

謝謝高手回覆
您說串口工具不支援輸入框里的\轉乂字符
那我改用0x0d 0x0a的方式輸入 可以嗎?

要如何才能使用arduino串口工具在no line ending下來做到同等於Both NL& CR的功能?
謝謝

histamine 发表于 2013-10-23 13:33:29

本帖最后由 histamine 于 2013-10-23 13:35 编辑

jimmyyjlee 发表于 2013-10-23 12:18 static/image/common/back.gif
謝謝高手回覆
您說串口工具不支援輸入框里的\轉乂字符
那我改用0x0d 0x0a的方式輸入 可以嗎?


请改arduino ide源代码,然后自行编译:lol

jimmyyjlee 发表于 2013-10-23 15:02:18

histamine 发表于 2013-10-23 13:33 static/image/common/back.gif
请改arduino ide源代码,然后自行编译

请改arduino ide源代码,
我已經用IDE源碼成功了,只是想試試看如何用串口工具下指令

histamine 发表于 2013-10-23 15:24:17

jimmyyjlee 发表于 2013-10-23 15:02 static/image/common/back.gif
我已經用IDE源碼成功了,只是想試試看如何用串口工具下指令

算我没说清楚,请改串口工具自身源代码:)
页: [1]
查看完整版本: 請問如何得到和Bath NL & CR一樣的效果?