I have a GPS sensor that is hardwired to take reading every 15 seconds. I need to run calculations using the readings given after the intervals. So, after the first run, store the latitude as x, and after its 15 seconds, pull that new latitude and save it as x1. How would I go about doing that in Python?
Sample of what I need to be done:
def ExpectedLocation(): LatitudeChange = x1 - x LongitudeChange = y1 - y ExpectedLatitude = x1 + LatitudeChange ExpectedLongitude = y1 + LongitudeChange
You can just swap x1 with x when you complete your operations.
Def ExpectedLocation(x1): x1 = getDataFromSensor() # sleep for 15 secs while True: x = getDataFromSensor() # doSomething() x1 = x # sleep for 15 secs
2.1m questions
2.1m answers
60 comments
57.0k users