AWOL:
Why not simply post the code, so that us folks on mobile devices can see it?
//Laser Control
int LD_Pin = 3; //Set LD pin
int LD_PWM = 100; //(0 - 255) 0 = off, 200 = 97 mA
int inc = 5;
int Laser_Idle_Duty = 150; // Control laser current (0 - 255)
int LD_enable = 0;
//TEC Control
float TEC_PWM = 100; //TEC heat/cool rate PWM value (0 - 255)
float thermister_voltage = 5.0; //analog read converted to voltage
float TEC_max = 30;
float TEC_min = 20;
int TEC_enable = 0;
float TEC_current = 0;
//TEC Temperature
float TEC_temp; //thermister_voltage converted to temperature
float steinhart;
// which analog pin to connect
#define THERMISTORPIN A2
// resistance at 25 degrees C
#define THERMISTORNOMINAL 10000
// temp. for nominal resistance (almost always 25 C)
#define TEMPERATURENOMINAL 25
// how many samples to take and average, more takes longer but is more 'smooth'
#define NUMSAMPLES 5
// The beta coefficient of the thermistor (usually 3000-4000)
#define BCOEFFICIENT 3950
// the value of the 'other' resistor
#define SERIESRESISTOR 10000
uint16_t samples[NUMSAMPLES];
//Internal photo detector
float PD_analog_read = 2.23; //2.23 is a place holder
//place holder elements
float element_9 = 9;
//Array to read/write to/from LabVIEW
float array[] = {thermister_voltage, TEC_temp, TEC_enable, TEC_max, TEC_min, TEC_current, LD_enable, LD_PWM, PD_analog_read, element_9};
void setup() {
Serial.begin(9600); //init serial port baud rate
randomSeed(analogRead(0)); //Generate different seed number if pin 0 is unconnected
pinMode(LD_Pin, OUTPUT); //Declare pin 9 to be an output
pinMode(7, OUTPUT); // declare pin to be an output
pinMode(8, OUTPUT); // declare pin to be an output
pinMode(9, OUTPUT); // declare pin to be an output
}
void loop() {
//thermister_voltage sampling and conversion
// read the input on analog pin 0:
int sensorValue = analogRead(A2);
// Convert the analog reading (which goes from 0 - 1023) to a voltage (0 - 5V):
thermister_voltage = sensorValue * (5 / 1023.0);
array[0] = thermister_voltage;
//TEC temperature sampling and conversion
uint8_t m;
float average;
// take N samples in a row
for (int m=0; m< NUMSAMPLES; m++) {
samples[m] = analogRead(A2);
delay(10);
}
// average samples
average = 0;
for (int n=0; n< NUMSAMPLES; n++) {
average += samples[n];
}
average /= NUMSAMPLES;
// convert to temperature
average = 1023 / average - 1;
average = SERIESRESISTOR / average;
steinhart = average / THERMISTORNOMINAL; // (R/Ro)
steinhart = log(steinhart); // ln(R/Ro)
steinhart /= BCOEFFICIENT; // 1/B * ln(R/Ro)
steinhart += 1.0 / (TEMPERATURENOMINAL + 273.15); // + (1/To)
steinhart = 1.0 / steinhart; // Invert
steinhart -= 273.15; // convert to C
TEC_temp = steinhart;
//READ IN ARRAY FROM SERIAL
if (Serial.available()) {
for (int i =0; i <=10; i++){
array[i] = Serial.parseInt();
}
}
//TEC Conditionals
TEC_enable = array[2];
TEC_max = array[3];
TEC_min = array[4];
TEC_current = array[5];
LD_PWM = array[6];
TEC_PWM = 0.13977*TEC_current;
if (TEC_enable == 0) {
// temp cycle off
digitalWrite(7,LOW);
digitalWrite(8,LOW);
analogWrite(9,0);
}
else {
if(TEC_temp >= TEC_max){
digitalWrite(7,HIGH);
digitalWrite(8,LOW);
analogWrite(9,TEC_PWM);
}
if (TEC_temp <= TEC_min){
digitalWrite(7,LOW);
digitalWrite(8,HIGH);
analogWrite(9,TEC_PWM);
}
}
//Laser Conditionals
LD_enable = array[6];
LD_PWM = array[7];
if (LD_enable == 0){
analogWrite(LD_Pin, 0);
}
if (LD_enable == 1){
analogWrite(LD_Pin, LD_PWM);
}
Serial.print(thermister_voltage); //thermister analog converted to 0 - 3.3V
Serial.print(",");
Serial.print(TEC_temp); //current temperature of TEC
Serial.print(",");
Serial.print(TEC_enable); //TEC max temperature
Serial.print(",");
Serial.print(TEC_max); //TEC max temperature
Serial.print(",");
Serial.print(TEC_min); //TEC min temperature
Serial.print(",");
Serial.print(TEC_PWM); //determines rate of TEC heating and cooling
Serial.print(",");
Serial.print(LD_enable); //TEC max temperature
Serial.print(",");
Serial.print(LD_PWM); //determines current through laser diode 20mA min, 200mA max
Serial.print(",");
Serial.print(PD_analog_read); //place holder for internal photodector analog read
Serial.print(",");
Serial.print(element_9); //place holder for element 9
Serial.print('\n');
//delay(100);
}
Your delay is coming from a timeout in readInt or somesuch
Yup...
array[i] = Serial.parseInt();