Pico help config

Author Message
lew247

Guru

Joined: 23/12/2015
Location: United Kingdom
Posts: 1527
 Posted: 12:48pm 22 Oct 2021

thwill said  Hi Lewis,
Untested, but does this work ?
Dim start%, now%
...
If Val(Speed2\$ < 3) Then
now% =  Val(Mid\$(Time\$, 4, 4))
If start% = 0 Then
start% = now%
ElseIf now% >= start% + 1 Then
Print "Time is up"
EndIf
Else
start% = 0
EndIf

Though you should probably be using values returned by Timer rather than Time\$.

Best wishes,

Tom

I tried this but I'm not certain it's working the way I want it to
I really need to check that the speed is still < 3 at a few stages up to 300000 (5 minutes)
That way I know defintely the car has stopped and the speed is definitely zero and I can put the cpu to sleep

I know I could do this simply by wiring it into the car, but I want to do it completely portable so the gps detects when the car is moving and goes to sleep when the car has stopped for 5 minutes

Hope that explained it ok

I'm just not certain my code below will test the speed enough times to know it's stopped.

I used <3 as the speed value because I've been testing the gps for a couple of days and it varies usually under 1mphg, but I've seen it touch 2mph even though the gps receiver is sat on the desk beside me.

Quote  If Val(Speed2\$ < 3) Then
now% =  Val(timer)
If start% = 0 Then
start% = now%
ElseIf now% >= start% + 300000 Then
If Val(Speed2\$ < 3)
Print "Time is up"
EndIf
Else
start% = 0
EndIf