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,运行代码即可看到效果。