Go Down

Topic: Having trouble on solving the following tasks (Read 5 times) previous topic - next topic

AWOL

My suggestion is to lose the the second i++ and j++ in the loops (I think I've already said this).

My suggestion is to test not for equality, but for a range of values. (I think others have said this).

I still don't know why you're looping through a table but using constant subscripts, or even why you're looping across the columns. Maybe you can answer this.
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Jonraptor


My suggestion is to lose the the second i++ and j++ in the loops (I think I've already said this).

My suggestion is to test not for equality, but for a range of values. (I think others have said this).

I still don't know why you're looping through a table but using constant subscripts, or even why you're looping across the columns. Maybe you can answer this.

Ok, i think i got it somehow working. Except it isn't as accurate as i've expected. I've followed your lead, and this is what i've done so far: -

Code: [Select]

void loop()
{

float Vin = 5.0;
float ThermResist = 0.0;
float R2 = 10000.0;
float SensorValue = 0.0;
float Vout = 0.0;
                         
  SensorValue = analogRead(ThermPin);
  Serial.print("Value = ");
  Serial.print(SensorValue);
 
  Vout = (((SensorValue+1)*Vin)/1024.0);
  Serial.print("\t Voltage = ");
  Serial.print(Vout);
  Serial.print(" V");
 
  ThermResist =((R2*Vin)/Vout)-R2;
  Serial.print("\t Resistance = ");
  Serial.print(ThermResist);
  Serial.println(" Ohm");
 
      if(ThermResist <= Table[4][1] && ThermResist >= Table[5][1])
      {
        Serial.print(Table[4][0]);
        Serial.println(" C");
      }

}


I've tried to go between those 2 values, but no luck. Except, if i've gone below Table[5][1], the printout statement have been triggered.

AWOL

Quote
Except it isn't as accurate as i've expected

Can you tell us what your expectations are, and how your observations differ?

What sort of value are you seeing for "TermResist"
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Jonraptor


Quote
Except it isn't as accurate as i've expected

Can you tell us what your expectations are, and how your observations differ?

What sort of value are you seeing for "TermResist"

My expectations is, if the ThermResist values hits below 3800. At the same time, stays above 3530. A printout statement of the Temp of 29 C have been initiated. Otherwise, it will keep on repeating the sensval, volt, & ohm outputs the usual.

ThermResist records the resistance of the Thermister, by adding the static resistance with it.

AWOL

OK, I'll try one more time.
What sort of value are you seeing for "ThermResist" ? (OK, I know I spelled it wrong last time)
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Go Up