From 8a13ea9ab669e5e21524e5a788baf09fa8ef7905 Mon Sep 17 00:00:00 2001 From: Adolfo Delorenzo Date: Thu, 11 Jul 2024 19:34:49 -0600 Subject: [PATCH] 2024-07-11 - --- GPS.py | 12 +++++++++++- gps_coordinates.db | Bin 0 -> 12288 bytes 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 gps_coordinates.db diff --git a/GPS.py b/GPS.py index 64652fd..d802cfc 100755 --- a/GPS.py +++ b/GPS.py @@ -1,12 +1,21 @@ #!/usr/bin/python # -*- coding:utf-8 -*- import RPi.GPIO as GPIO +import paho.mqtt.client as mqtt import serial import time, os +# MQTT Broker settings + +mqttBroker ="65.108.199.212" +myhost = os.uname()[1] +client = mqtt.Client(myhost) +client.connect(mqttBroker, 1883) + ser = serial.Serial('/dev/ttyS0',115200) ser.flushInput() + rec_buff = '' rec_buff2 = '' time_count = 0 @@ -39,6 +48,7 @@ def get_gps_position(): time.sleep(2) while rec_null: answer = send_at('AT+CGPSINFO','+CGPSINFO: ',1) + client.publish("iiot/"+ myhost +"/gps", answer, 0) if 1 == answer: answer = 0 if ',,,,,,' in rec_buff: @@ -85,4 +95,4 @@ except: GPIO.cleanup() if ser != None: ser.close() - GPIO.cleanup() + GPIO.cleanup() diff --git a/gps_coordinates.db b/gps_coordinates.db new file mode 100644 index 0000000000000000000000000000000000000000..c9b5c067772c96693b0e6dd65e29eb0a535ced1f GIT binary patch literal 12288 zcmeI#KTE?v7{~FuRCJQMb$y^qYm19-z$k}={x!xSlf>qfK%3C^y1Dcv_>R4Z#oEPH z%J+fG9ta%4@Y+WKOQth0