driven the last 5 Minutes

Post your questions and help other users.

Moderator: Martin

Post Reply
inReinbek
Posts: 95
Joined: 02 Feb 2013 22:04

driven the last 5 Minutes

Post by inReinbek » 18 Mar 2013 14:16

I want to crate a flow that's sending a SMS to a caller while I'm on the road.
Up to this I want to send the SMS only while I was driving the last 5 Minutes (average speed higher than 10km/h for the last 5 minutes).

This flow should be read every 10 to 15 seconds the speed-variable from GPS (always on while I'm driving 'cause I've power supply in my car).

So I tried to set up the speed parameter as a variable set in relation to time.
Reading speed is no problem, reading time also is no problem.

My problem starts by setting speed and time in a variable to calculate a SMS-condition.
Is anyone able to help me ?

bobchernow
Posts: 56
Joined: 16 Mar 2013 14:10

Re: driven the last 5 Minutes

Post by bobchernow » 18 Mar 2013 19:00

http://automagic4android.com/flow.php?i ... 8d77afa2c3

This script/flow will store current time(date) and speed globally so other flows can access them of you could trigger the sms from this flow.

inReinbek
Posts: 95
Joined: 02 Feb 2013 22:04

Re: driven the last 5 Minutes

Post by inReinbek » 18 Mar 2013 19:33

Thank you, that's my first step, too. Now I've to store those variables every 10 seconds to calculate my average speed for the last 5 minutes ... do you have any ideas to store 30 variables periodicly and calculate "sum of 30vars divided by 30"?

I try to record the variable "location_speed" for about 30 times in a List.


My script is
--------script ---------------------
addElement(speli, location_speed+"\\n");
div = length (speli);
for (i in [0 to div])
{single = getElement (speli,i);
sumspeed = sumspeed+single
}
avspeed = sumspeed/div;
---------------------------------------

Checking the used variables on the screen always results a "null".
Where at hell is my mistake ?

Post Reply