From 4ce0d016eee9901ed818133cde8bcac3e71d196f Mon Sep 17 00:00:00 2001 From: Umer Farooq <35717992+umer0586@users.noreply.github.com> Date: Sat, 19 Oct 2024 10:32:50 +0500 Subject: [PATCH] Update README.md --- README.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index b901173..499cdc3 100644 --- a/README.md +++ b/README.md @@ -74,8 +74,8 @@ import json def onData(data): jsonData = json.loads(data) sensorType = jsonData["type"] - timestamp = jsonData["timestamp"] - values = jsonData["values"] + timestamp = jsonData.get("timestamp") + values = jsonData.get("values") if sensorType == "android.sensor.accelerometer": x, y, z = values @@ -83,7 +83,10 @@ def onData(data): if sensorType == "android.sensor.gyroscope": x, y, z = values - print(f"gyroscope : x = {x}, y = {y}, z = {z} timestamp = {timestamp} ") + print(f"gyroscope : x = {x}, y = {y}, z = {z} timestamp = {timestamp} ") + + if sensorType == "android.gps": + print(jsonData) # Initialize the server to listen on all network interfaces (0.0.0.0) and port 8080 server = UDPServer(address=("0.0.0.0", 8080))