Hello Processing community!
I'm trying to visualize some data gathered via Arduino in Processing. Right now, the Arduino collects a string of numbers via EEG, all separated by commas. I'm just really confused at to what I should do in processing to get the program to use these separate numbers as variables in a visualization...... Can anyone shed some light?
Right now I have it so that Processing is able to print the serials form the Arduino:
- import processing.serial.*; //import the Serial library
- int end = 10;
- String serial;
- Serial port;
- void setup() {
- port = new Serial(this, Serial.list()[0], 9600);
- port.clear();
- serial = port.readStringUntil(end);
- serial = null;
- }
- void draw() {
- while (port.available () > 0) {
- serial = port.readStringUntil(end);
- }
- if (serial != null) {
- String[] a = split(serial, ',');
- delay(100);
- print("a[0] : ");
- println(a[0]); //print Value1 (in cell 1 of Array - remember that arrays are zero-indexed)
- print("a[3] : ");
- println(a[3]);
- print("a[5] : ");
- println(a[5]);
- print("a[7] : ");
- println(a[7]); //print Value7 value
- delay(100);
- }
- }