Hi all -
I'm using LabVIEW and a Firgelli PQ-12-P linear actuator controlled by the Arduino Duemilanove. I have a small photodiode mounted on the Firgelli, and I want it to "sweep" across a few steps. The Firgelli takes a small step using EXTEND below, and a multimeter will takes a current reading at that point. It does this several times in a row. Then, the LabVIEW VI will decide which point (of Firgelli motion) the detector/multimeter recorded a maximum, and it will command the Firgelli to return to that point. (More things happen before or after this step, but this is the only step that talks to the Arduino.)
The problem is that this requires forward and backward motion, which are two seperate "bundles of code" (not sure of the correct term, sorry) below which EXTEND or RETRACT the Firgelli. I have no problem getting LabVIEW to repeatedly do one of the two motions (whichever was last uploaded on the Arduino board).
Basically I need to know how to use LabVIEW to do both. This would require an intermediary step - once it has taken all its readings in the forward (EXTEND) direction, pause and upload the RETRACT code, and then run that. How do you get LabVIEW to upload new code onto the board?
void(setup) {
//EXTEND
pinMode(3, OUTPUT);
pinMode(2, OUTPUT);
digitalWrite(2, LOW);
digitalWrite(3, HIGH);
delay(10);
digitalWrite(2, LOW);
digitalWrite(3, LOW);
}
void(loop)
{
}
and
void(setup) {
//RETRACT
pinMode(3, OUTPUT);
pinMode(2, OUTPUT);
digitalWrite(3, LOW); // switch 2 to 3
digitalWrite(2, HIGH); // switch 3 to 2
delay(10);
digitalWrite(2, LOW);
digitalWrite(3, LOW);
}
void(loop)
{
}