极客工坊

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 7655|回复: 1

图形化监看你的程序执行效果

[复制链接]
发表于 2015-3-18 10:30:27 | 显示全部楼层 |阅读模式
根据本坛贴子指导,发现这个工具作为辅助还挺不错的,只可惜一年多没有更新了。貌似只需要include一个h文件就可以实现对于简单程序、对时间要求不高的地方或者对某功能独立调试时可以实时看到程序效果,简单使用有道辞典翻译后嵌入网页,对初学者来说很实用呢,大家看看效果吧:in  Japanese[ArduinoConf][ArduinoMonitor][iArduino]

过程:下载软件=>嵌入语句=>打开软件并连接上你的COM口
这是个绿色软件,意味着不需要安装什么东西,打开就能用。

级别不够不能发图

Monitor program for ArduinoAbstract
You can control Arduino's pins by ArdunoMonitor and watch changes on pins.  This is useful for debugging your hardware before you write a sketch.  
您可以控制Arduino的别针ArdunoMonitor和观察变化。 这是用于调试你的硬件,然后再编写一个草图。

Before you begin
Place iArduino folder into your libaries folder of your Arduino folder. Then,  upload Examples->iArduino to Arduino.
地方iArduino文件夹到你的机库文件夹Arduino文件夹中。然后,上传示例- > iArduino Ardu

Start ArduinoMonitor
Connect Arduino and PC, then execute ArduinoMonitor.  Chose the serial port  Arduino is connected and click ``Connect'' button. You will see that it starts  updating pins' status on Arduino. Note that all the pins on Arduino except for  pin 13 (LED's pin) are inputs with the skecth below. This is different from the  Firmata example which comes with Arduino IDE. The example makes pins as digital  output (LOW).
Arduino和电脑连接,然后执行ArduinoMonitor。 选择了串口Arduino连接,然后单击“连接”按钮。你会发现它开始更新销对Arduino的状态。注意,所有的针Arduino除了销13(销)领导与skecth输入如下。这不同于Firmata例子来自Arduino IDE。 这个例子使针数字输出(低)。
The connection is terminated by clicking ``Disconnect'' button. Click `X' to  quit ArduinoMonitor.  
连接终止通过点击“断开”按钮。单击“X”ArduinoMonitor戒烟。

Changing pin modes and values 改变销模式和价值观
Select the usage of the pins from pull down menu on the side of the pin. DIN  and AIN corresponds to digital and analog input. If you chose DOUT (digital  out), radio buttons LOW and HIGH appear to change its logic level. If you chose  PWM (analog output) or RC (R/C servo motor), it shows a lider to the pin's  control output value.
从下拉菜单中选择使用针的针。喧嚣 难道对应于数字和模拟的输入。如果你选择DOUT(数字 ),单选按钮高低似乎改变其逻辑电平。如果你选择 PWM(模拟输出)或RC(R / C伺服马达),它显示了一个盖销的 控制输出值。

Converting analog value
If you check ``show in voltage'', the values of analog pins are show in  voltage rather than direct value. You need to put analog refrence voltage on the  text box under the check box. It is 5[V] by default.  
如果你在电压”,检查“显示的值显示在模拟别针 电压,而不是直接的价值。你需要把模拟参考电压 文本框下的复选框。默认是5[V]。

Logging
It starts logging in CSV format by clicking ``Start Log'' button. Note, it  will overwrite an existing file. The sampling rate is about 0.1s per sample.  Click ``Stop Log'' button to stop logging.  
它开始登录CSV格式,点击“开始记录”按钮。注意,它 将覆盖现有的文件。采样率是每样0.1s。 单击“停止日志”按钮停止记
Displaying a graph
It shows a graph window by clicking ``Graph'' button. The window shows status  of the pins as a graph. Blue lines indicate lowest value (0) on pins. Red lines  indicate highest value (1 for digital inputs and ouputs, 1023 for analog inputs,  255 for PWM (analog outputs), and 180 for RC servos) on pins.  
它显示一个图形窗口点击“图表”按钮。窗口显示状态 针的图。蓝线显示最小值(0)别针。红线 数字输入和输出显示最高价值(1,1023模拟输入, 255 PWM(模拟输出),255 RC伺服)别针。
It stops updates of the graph by clickng ``Stop'' button. The ``Clear''  button clears graph area. It saves a graph image in PNG format by clicking  ``Save PNG'' button. It saves values in CSV format by clicking ``Save CSV''  button. The close button is for closing the window. The sampling rate is about  0.1s per sample.  
它停止更新clickng图的“停止”按钮。“清楚” 按钮清除图区域。它节省了PNG格式的图形图像通过点击 “拯救PNG”按钮。它将值保存在CSV格式通过点击“保存CSV” 按钮。关闭按钮关闭窗口。的采样率 每样0.1s。

Saving and loading a configuration
It saves and loads configuration in XML format by clicking ``Save'' and  ``Load'' buttons. The file to save/load is specified by the text box above the  buttons. Note, it will load/save without showing a file dialogue if the file is  specified. You see the dialogue by double clicking the text box.
它以XML格式保存和加载配置,点击“保存” “加载”按钮。指定的文件保存/加载上方的文本框 按钮。注意,它会加载/保存文件对话如果文件没有显示 指定。你看到的对话通过双击文本框。

Example sketch
Pressing `Show code' button shows source code for Arduino IDE. Use "Save"  button to save to a file. The window will close when you click ``Close'' button.  
按下“显示密码”按钮显示源代码Arduino IDE。使用“保存” 按钮保存到一个文件。窗口将关闭,当你点击“关闭”按钮。

Using ArduinoMonitor with your sketchBareMinimum
You can monitor pin values while Arduino is running your sktech from version  0.2 of ArduinoTerminal. An example sketch is available in iArduino ->  ArduinoTerminal -> BareMinimum.  Put your codes as comment suggests. Since  Arduino and ArduinoTerminal communicates in debug.check() function, you cannnot  monitor if the function is not called.
您可以监视销值虽然Arduino运行sktech ArduinoTerminal的0.2版本。 素描一个例子是在iArduino - > ArduinoTerminal - > BareMinimum可用。 把你的代码,建议发表评论。由于Arduino和ArduinoTerminal沟通debug.check()函数,您却说监控如果函数没有。

  1. #include <EEPROM.h>             // include EEPROM.h even if you don't need it
  2. #include <Servo.h>              // include Servo.h even if you don't need it
  3. #include <iArduino.h>           // include library header

  4. iArduinoHandleProtocol debug;   // declare iArduinoHandleProtocol

  5. void setup() {
  6.   debug.begin();               // initialize iArduinoHandleProtocol
  7.                                  // Serial port is initialized at
  8.                                // 115.2kbps.
  9.   // put your setup code here, to run once:

  10. }

  11. void loop() {
  12.   debug.check();               // call this function periodically
  13.   // put your main code here, to run repeatedly:
  14.   
  15. }
复制代码
BlinkWithoutDelay
Here is annother example based on 0.Digital -> BlinkWithoutDelay. This  example blinks LED on pin 13 and sends HIGH/LOW to PC via serial port. Arduino  answers back "Recieved 1." if you send '1' from PC. Text box on the left of  ArduinoMonitor is the therminal area.  
You can use Serial.println() and other print() functions as usual. You need  to use debug.available() or debug.read() instead of Serial.available(),  Serial.read(). Please make it sure that either Arduino nor PC sends 0x7f which  is used for debugging protocol.  
You can use your sketch ASIS after debugging.  
这里是基于0 annother例子。数字- > BlinkWithoutDelay。 这个例子眨眼在销13日和向个人电脑通过串口发送高/低。Arduino答案”收到1。 “如果你从电脑发送“1”。文本框左边ArduinoMonitor therminal区域。 您可以使用以()和其他打印()函数。您需要使用debug.available()或debug.read()而不是Serial.available(),Serial.read()。 请它确保Arduino和PC发送0 x7f用于调试协议。 你可以用你的草图后网络调试。

  1. /*
  2.    This sketch shows an example use of iArduinoTerminal for debugging without
  3.    using iArduino language. The sketch extends Blink without Delay in the example.
  4. */
  5. /*这个草图显示了一个示例使用iArduinoTerminal调试
  6. 使用iArduino语言。 素描延伸眨眼及时的例子。
  7. */
  8. #include <EEPROM.h>             // include EEPROM.h even if you don't need it
  9. #include <Servo.h>              // include Servo.h even if you don't need it
  10. #include <iArduino.h>           // include library header

  11. iArduinoHandleProtocol debug;   // declare iArduinoHandleProtocol

  12. const int ledPin =  13;
  13. int ledState = LOW;
  14. long previousMillis = 0;
  15. long interval = 1000;

  16. void setup() {
  17.   debug.begin();               // Setup, serial port is initialized.
  18.                                // The baudrate is 115.2kbps.
  19.   pinMode(ledPin, OUTPUT);
  20. }

  21. void loop()
  22. {
  23.   debug.check();               // Periodiclly call this function

  24.   unsigned long currentMillis = millis();

  25.   if(currentMillis - previousMillis > interval) {
  26.     previousMillis = currentMillis;   

  27.     if (ledState == LOW) {
  28.       ledState = HIGH;
  29.       Serial.println("HIGH");  // You can use Serial.flush, print, println, and write
  30.                                // as usual.
  31.     } else {
  32.       ledState = LOW;
  33.       Serial.println("LOW");
  34.     }

  35.     digitalWrite(ledPin, ledState);
  36.   }

  37.   if (debug.available()) {    // Use available() of iArduinoHandleProtcol instead of
  38.                               // Serial.available()
  39.     int c = debug.read();     // Use read() of iArduinoHandleProtcol instead of
  40.                               // Serial.read();
  41.     if (c == '1')
  42.       Serial.println("Recieved 1.");
  43.   }
  44. }
复制代码
NotesInstalling  You need .NET Framework 4 to use this program.   
Download
&#8226;ArduinoMonitor-0.2c.zip   (latest, for Ardino with ATmega328, e.g. Diecimila, Duemillanove, UNO, etc.   will support Leonard with Arduino IDE 1.0.2 or later)
&#8226;StandardFirmata_2_2_forUNO_0_3_INPUT.zip   (for Arduino, tested with Arduino IDE 0022, for ArduinoMonitor-0.1)
History
&#8226;0.2c: 2014/1/15 Bugfix release (analogRead function did not accept A0, A1,   etc.)
&#8226;0.2b: 2012/08/07 Bugfix release (handling of R/C servo etc.)
&#8226;0.2a: 2012/07/18 Enabled auto reset as the default for the safty
&#8226;0.2: 2012/07/14 Second release (protocol is changed)
&#8226;0.1: 2011/12/2 First release
回复

使用道具 举报

发表于 2015-3-18 20:32:27 | 显示全部楼层
谢谢分享学习一下
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则 需要先绑定手机号

Archiver|联系我们|极客工坊

GMT+8, 2024-4-19 14:46 , Processed in 0.044462 second(s), 18 queries .

Powered by Discuz! X3.4 Licensed

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表