Calculating Tau

Hey, i am currently making a capacitance measurement circuit, and i need to use the calculation below to find out the time constand (tau) :

Tau= -t
ln(1-(Vc/c))

I know all the values for Vc and V, all that varies is the t.
The t refers to time, so obviously it inuts into a positive number, i need to change it into a negative and then complete the calculation above.
at the moment i have got this:

Tau= (elapsedTime/(log(1-(ThreshH/5))));

i am not able to change the value "eleapsed time" to a negative number, but that isnt such a problem.

i am then outputing Tau into the "Serial.Print" and just getting 0?

Any sujestions?

Cheers, Jamie

Any sujestions?

Post your code.

so obviously it inuts into a positive number,

Translation, please.

Assuming this is the code line

29guitarman:

Tau= (elapsedTime/(log(1-(ThreshH/5))));

The possible/probable errors are that you mix [b]int[/b] and
** **float** **
. Make sure all the variabes are float and make all your constants floattype, too (just to be safe) i.e. write 1.0 not 1.

Tau= ((float)elapsedTime/(log(1.0 - (ThreshH/5.0))));

Can help as it will works with floats/doubles values.

May be, it would be better to check if the values au Tau are correctby displaying it on the monitor...

Give us some news about it.

i am not able to change the value "eleapsed time" to a negative number

elapsedTime/(log(1.0 - (ThreshH/5.0))); ==> (0-elapsedTime)/(log(1.0 - (ThreshH/5.0)));

should work.