list1 /* Gainer analog in */ import processing.funnel.*; Gainer gainer; PFont myFont; void setup() { size(400,250); myFont = loadFont("CourierNewPSMT-24.vlw"); textFont(myFont, 24); gainer = new Gainer(this,Gainer.MODE2); } void draw() { background(0); text("analogInput[1]: " + gainer.analogInput(1).value,10,110); } --- List2 /* Fio analog in */ import processing.funnel.*; Fio fio; PFont myFont; void setup() { size(400,130); myFont = loadFont("CourierNewPSMT-24.vlw"); textFont(myFont, 24); int[] moduleIDs = {1}; fio = new Fio(this,moduleIDs,Fio.FIRMATA); } void draw() { background(0); text("analogInput[0]: " + fio.iomodule(1).analogPin(0).value,10,80); } --- List3 /* CT logger for Gainer */ import processing.funnel.*; Gainer gainer; PFont myFont; PrintWriter logFile; float offset = 0.06; float gain = 0.592; float calibrate(float v) { return (v + offset) / gain; } void setup() { size(400,250); myFont = loadFont("CourierNewPSMT-24.vlw"); logFile = createWriter("log-data.txt"); textFont(myFont, 24); frameRate(10); gainer = new Gainer(this,Gainer.MODE2); } int flag = 0; void draw() { background(0); float v = gainer.analogInput(1).value; text("analogInput[1]: " + v, 10,110); text("Amp: " + calibrate(v), 10,140); if (second() == 0) { if (flag == 0) { String s = year() + "/" + month() + "/" + day() + " " + hour() + ":" + minute() + ":" + second() + " " + calibrate(v); logFile.println(s); println(s); flag = 1; } } else { flag = 0; } } void keyPressed() { if (key == 'e') { logFile.flush(); // Writes the remaining data to the file logFile.close(); // Finishes the file exit(); // Stops the program } }