So I need some help loading data into array for use with
giCentreUtils XY Chart. I keep getting "ArrayIndexOutOfBoundsException: 3. Its shown below, I highlighted the line I get the error on. The file I am trying to read in is here:
Ferm.txt.
Any help is greatly appreciated.
import org.gicentre.utils.stat.*; // For chart classes.
// Sketch to demonstrate the use of the XYChart class to draw simple line charts. // Version 1.0, 27th May, 2010. // Author Jo Wood.
XYChart lineChart;
/** Initialises the sketch, loads data into the chart and customises its appearance. */
String[] lines; float x = 0; float y = 0; int count = 0;
import processing.serial.*; Serial myPort; BufferedReader reader;
PFont font = createFont("Helvetica",11); textFont(font,10);
float [] Xdata = new float [lines.length]; float [] Ydata = new float [lines.length]; for (int i = 1; i < lines.length; i++) { String[] pieces = split(lines[i], ","); x = float(pieces[3]); y = float(pieces[6]); Ydata[i] = y; Xdata[i] = x; }
// Both x and y data set here. lineChart = new XYChart(this); lineChart.setData(Xdata, Ydata);
// Axis formatting and labels. lineChart.showXAxis(true); lineChart.showYAxis(true); lineChart.setMinY(0);
lineChart.setYFormat("00.00"); // Monetary value in $US lineChart.setXFormat("00.00"); // Year
// Symbol colours lineChart.setPointColour(color(180,50,50,100)); lineChart.setPointSize(5); lineChart.setLineWidth(2); }
/** Draws the chart and a title. */ void draw() { background(255); textSize(9); lineChart.draw(15,15,width-30,height-30);
// Draw a title over the top of the chart. fill(120); textSize(20); text("Fermentation Temp", 70,30); textSize(11); //text("Gross domestic product measured in inflation-corrected $US", 70,45); }
I am running Ubuntu 10.10 32 bit and I am fairly new to linux. I have a arduino uno and I am running arduino-0022, processing-1.2.1. I can upload sketches to arduino and using the serial monitor in arduion-0022 It is spitting out data. When I run processing the only port it list is ttyS0. So processing never receives and data from the arduino. Attached is picture showing that ttyACM0 is selected in arduino put port the only port listed in processing is ttyS0.
I am sure there are guys out there using arduino uno and processing. How did you get this to work.
I have searched the forums and didn't quite find the answer. I am new to processing and controlP5 so sorry for the simple question.
I am trying to add text field and have it update the time. I can't seem to get the controlP5 library to update the text field. below is my code. Thanks in advance.