PaulS:
Your still flapping your arms and not communicating. Let’s see some code.
Haha, sorry 
Ok… Please apologise for any hideously formatted parts of my code, its my first try.
This is the main part of the sketch, i.e. the first tab in my program:
// Need G4P library
import guicomponents.*;
import processing.serial.*;
import cc.arduino.*;
// analog variables
int[] vals;
int val;
// My pin assignments
Arduino arduino;
int ledPin = 12;
int pin=0;
int switchPin=8;
void setup(){
size(480, 320);
// text analog
vals = new int[width];
PFont font;
font = loadFont("sansserif-24.vlw");
textFont(font);
// text analog finished
// For the GUI builder
createGUI();
customGUI();
//Setup my serial to the arduino running firmata
arduino = new Arduino(this, "COM7", 57600);
arduino.pinMode(ledPin, Arduino.OUTPUT);
arduino.pinMode(switchPin, Arduino.INPUT);
}
// Display some analog pin values from the ADC
void draw(){
background(200,220,200);
// shift array left by one
for(int i=1; i<width; i++) {
vals[i-1] = vals[i];
}
// add the new values to the end of the array
// read potentiometer (0..1024), divide by four (0..255)
// to stay within canvas drawing limits
String sch = "ON";
val = arduino.analogRead(pin);
vals[width-1] = val/4;
if(arduino.digitalRead(switchPin)==Arduino.LOW) {
sch = "OFF";
} else {
sch = "ON";
}
textAlign(RIGHT);
text("Pin 0: "+val, 200, 30);
text(5.0*(vals[width-1]/255.0)+"V",200,60);
text(sch ,200,90);
}
// Use this method to add additional statements
// to customise the GUI controls
void customGUI(){
}
And this is the second tab which was generated by the GUI builder and I am trying to input my sequences into:
/* =========================================================
* ==== WARNING ===
* =========================================================
* The code in this tab has been generated from the GUI form
* designer and care should be taken when editing this file.
* Only add/edit code inside the event handlers i.e. only
* use lines between the matching comment tags. e.g.
void myBtnEvents(GButton button) { //_CODE_:button1:12356:
// It is safe to enter your event code here
} //_CODE_:button1:12356:
* Do not rename this tab!
* =========================================================
*/
void button1_Click1(GButton button) { //_CODE_:button1:488357:
// MY SEQUENCE HERE:-
while(arduino.analogRead(pin) > 10);
println("pumping");
arduino.digitalWrite(ledPin, Arduino.HIGH);
while(arduino.analogRead(pin) < 1000);
println("stop");
arduino.digitalWrite(ledPin, Arduino.LOW);
while(arduino.digitalRead(switchPin)==Arduino.HIGH);
println("stop");
arduino.digitalWrite(ledPin, Arduino.LOW);
} //_CODE_:button1:488357:
void textfield1_Enter1(GTextField textfield) { //_CODE_:textfield1:337688:
println("textfield1 - GTextField event occured " + System.currentTimeMillis()%10000000 );
println(Arduino.list());
println(val);
} //_CODE_:textfield1:337688:
void button2_Click1(GButton button) { //_CODE_:button2:542520:
println("button2 - GButton event occured " + System.currentTimeMillis()%10000000 );
} //_CODE_:button2:542520:
// Create all the GUI controls.
// autogenerated do not edit
void createGUI(){
G4P.setColorScheme(this, GCScheme.BLUE_SCHEME);
G4P.messagesEnabled(false);
button1 = new GButton(this, "Face text", 194, 69, 80, 30);
button1.setTextAlign(GAlign.CENTER | GAlign.MIDDLE);
button1.addEventHandler(this, "button1_Click1");
textfield1 = new GTextField(this, "Some text", 198, 185, 80, 20, false);
textfield1.addEventHandler(this, "textfield1_Enter1");
label1 = new GLabel(this, "My label", 291, 184, 80, 20);
button2 = new GButton(this, "Face text", 346, 56, 80, 30);
button2.setTextAlign(GAlign.CENTER | GAlign.MIDDLE);
button2.addEventHandler(this, "button2_Click1");
}
// Variable declarations
// autogenerated do not edit
GButton button1;
GTextField textfield1;
GLabel label1;
GButton button2;
When I press the button on the GUI the analog values fail to update until the sequence is complete. I also do not seem to be able to interrupt the sequence or start another (if I insert another sequence for the second button)