Hi,
I have the following problem, that I can`t figure out.
I want to code a G Meter, that only records the maximum and minimum values, as they come.
Here`s my code, that does not work.
momentGforce = acc.z(); // acc.z() is the sensor value, rewnewal rate 60Hz
if ( momentGforce > maxGforce )
{
maxPrintForce = maxGforce;
textAreaGmeter.ClearArea();
textAreaGmeter.print("Max G");
textAreaGmeter.CursorTo(2);
textAreaGmeter.println(maxPrintForce/10.0, 1);
}
The read out is 0.
I am trying already the whole afternoon, can any body direct me in the right direction ?
appreciate any help,
truely Johannes
Hard code a value for maxGForce and momentGforce.
//momentGforce = acc.z(); // acc.z() is the sensor value, rewnewal rate 60Hz
momentGforce = 40;
maxGforce = 20;
if ( momentGforce > maxGforce )
{
maxPrintForce = maxGforce;
textAreaGmeter.ClearArea();
textAreaGmeter.print("Max G");
textAreaGmeter.CursorTo(2);
textAreaGmeter.println(maxPrintForce/10.0, 1);
}
If something prints, then you know either maxGforce has not been set or maxGforce has not been set.
This is what I suspect.
system
3
if ( momentGforce > maxGforce )
{
maxPrintForce = maxGforce;
textAreaGmeter.ClearArea();
textAreaGmeter.print("Max G");
textAreaGmeter.CursorTo(2);
textAreaGmeter.println(maxPrintForce/10.0, 1);
}
Drinking
and
coding
do
not
go
together.
Quit
one
of
them.
You don't show any place where you set 'maxGforce' to anything other than 0.
What you thought you were doing is:
float maxGforce = 0;
void setup() {}
void loop() {
momentGforce = acc.z(); // acc.z() is the sensor value, rewnewal rate 60Hz
if ( momentGforce > maxGforce )
{
maxGforce = momentGforce; // You left out this line.
maxPrintForce = maxGforce;
textAreaGmeter.ClearArea();
textAreaGmeter.print("Max G");
textAreaGmeter.CursorTo(2);
textAreaGmeter.println(maxPrintForce / 10.0, 1);
}
}
You Arena so Right,
Only I Startes drinking only After I got YOUR help ! Hicks !
Drinking
and
coding
do
not
go
together.
Quit
one
of
them.
[/quote]