Hi, I have to put a section in loop to find the following :
Given that I know an i/p analogue voltage on A2,A3,A4, that corrisspond to Vin, V50 and VL.
Then the following needs to be calculated:
A.....VRL22 + VXL2 = VL2 and rearranging, then,
B......VXL2 = VL2 - VRL2
Also from a vector diagram
C.....(V50 + VRL2) + VXL2 = Vin2
Substituting (1) into (2) then;
D.....VRL = Vin2 - V502 - VL2/ 2 x V50
E.....RL = VRL X 50 / V50 and
F.....XL = VXL X 50 / V50
I am lost now, I have thought that the following would sort me out but it doesn't seem to be correct:
val1 = analogRead(val1); //Vin reads analog input A2 into val
val2 = analogRead(val2); //V50 reads analog input A3 into val
val3 = analogRead(val3); //VL reads analog input A4 into Val
val4 = sq(val1); //Vin squared
val5 = sq(val2); //V50 squared
val6 = sq(val3); //VL squared
val7 = (2 * val2); //2 x V50
val8 = (val4 - val6 - val7) / val7; //value of RL
val9 = sq(val8); //VRL squared
val10 = (val3 - val8); //VXL squared
val11 = sqrt(val10); //value of XL
lcd.setCursor(11, 2);
lcd.print(val11);
I am an old codger at 70 and this is driving bonkers, greyer and her indoors is looking up the divorce paper's,
It's taken me two hours to write this. The rest of my program works fine and I find it helps keep the grey matter going.
Can some kind gent save my bacon. Thanks