Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
umer0586 committed Oct 20, 2024
2 parents 8982c67 + 4ce0d01 commit e922cb8
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,16 +74,19 @@ 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
print(f"accelerometer : x = {x}, y = {y}, z = {z} timestamp = {timestamp} ")

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))
Expand Down

0 comments on commit e922cb8

Please sign in to comment.