• win 7 processing 编程环境搭建


    1、下载processing安装包:

    2、下载usb驱动:

    3、安装processing;

    4、安装驱动:

    5、在processing中编写代码:

    // Visualizing the data from EMFIT device in a waveform
    // Processing reads the data from the USB port and connects all the data points with lines, creating a waveform
    // Ideally, only the similar data points of for example heart rate should be connected for a clear understanding of the data.
    // Cody written by Ruben van Dijk, student industrial design at University of Technology Eindhoven
    
    import processing.serial.*;
    
    Serial myPort;  // The serial port
    
    // VARIABLES____________________________________
    
    int[] y;
    
    void setup() {
      size(1000, 255);
      y = new int[width];
    
      printArray(Serial.list());
      // Open the port you are using at the rate you want:
      myPort = new Serial(this, Serial.list()[0], 9600);
    }
    
    void draw() {
      while (myPort.available () > 0) {
        int inByte = myPort.read();
        println(inByte);
    
    
        background(204); 
        // Read the array from the end to the
        // beginning to avoid overwriting the data
        for (int i = y.length-1; i > 0; i--) {
          y[i] = y[i-1];
        }
        // Add new values to the beginning
        y[0] = inByte;
        // Display each pair of values as a line
          for (int i = 1; i < y.length; i++) {
          line(i, y[i], i-1, y[i-1]);
          
        }
      }
    }

    6、连接usb,运行代码即可看到效果。

  • 相关阅读:
    http协议(二、报文格式)
    http协议(一、基础部分)
    echarts双轴轴线不对齐的解决办法
    svn 强制解锁的解决办法
    分析器错误
    JQgrid for asp.net
    养生宝典,值得一读(健康养生)
    ORM框架是什么
    WebSite和WebApplication的区别
    MVC3和MVC4相关问题
  • 原文地址:https://www.cnblogs.com/HendSame-JMZ/p/6049892.html
Copyright © 2020-2023  润新知