I'm using a potentiometer to measure angle. Since potentiometers max angle varies I'm using another potentiometer to adjust the max angle.
But this calculation is not working. In the maximum range Shaft angle should have shown 360 but its showing 499.That means only (shaftVolt * 100)
is working. And dividing it with Ratio is not working.
AdjVolt = (AdjVolt * 100) / 1.38611
Ratio = (499 / AdjVolt)
//shaftVolt = (shaftVolt * 100) / 1.38611
shaftVolt = (shaftVolt * 100) / Ratio
Thank you
ADC Calculation is getting wrong
Moderator: Benj
-
- Posts: 8
- Joined: Mon Aug 05, 2019 8:15 pm
- Has thanked: 5 times
- Contact:
ADC Calculation is getting wrong
- Attachments
-
- Screenshot_2.png
- (79.22 KiB) Downloaded 1695 times
-
- Guddu keypad copied v5 to v8 With Adj.fcfx
- (25.52 KiB) Downloaded 194 times
-
- Posts: 8
- Joined: Mon Aug 05, 2019 8:15 pm
- Has thanked: 5 times
- Contact:
Re: ADC Calculation is getting wrong
I have changed Ratio from Int to Float. Now its showing just 0 wherever the Potentiometer is.
Thanks.
Thanks.
- LeighM
- Matrix Staff
- Posts: 2178
- Joined: Tue Jan 17, 2012 10:07 am
- Has thanked: 481 times
- Been thanked: 699 times
- Contact:
Re: ADC Calculation is getting wrong
The LCD PrintNumber() can only print integers.
For float values first convert to a string with FloatToString$()
Then print the string
For float values first convert to a string with FloatToString$()
Then print the string
-
- Posts: 8
- Joined: Mon Aug 05, 2019 8:15 pm
- Has thanked: 5 times
- Contact:
Re: ADC Calculation is getting wrong
Thanks Leigh,
It worked. But showing the value e.g as 270.434245 but if I want to show just two or three values after decimal as "176.34" or completely remove the values after decimal point along with the point "." as"176" what should I do.
It worked. But showing the value e.g as 270.434245 but if I want to show just two or three values after decimal as "176.34" or completely remove the values after decimal point along with the point "." as"176" what should I do.