diff --git a/Azure_IoT_Hub_GPS/Azure_IoT_Hub_GPS.ino b/Azure_IoT_Hub_GPS/Azure_IoT_Hub_GPS.ino index a075745..6f88b7c 100644 --- a/Azure_IoT_Hub_GPS/Azure_IoT_Hub_GPS.ino +++ b/Azure_IoT_Hub_GPS/Azure_IoT_Hub_GPS.ino @@ -512,8 +512,8 @@ void split(String string) } } -// NMEA latt,long values ar 100x so just shift decimal point left 2 in the string -// Could convert to double then divide by 100 but want as string +// THE FOLLOWING HAS BEEN UPDATED (CORRECTED): +//See https://davidjones.sportronics.com.au/web/GPS-NMEA_101-web.html String ShiftLeft2(String num) { for (int i = 0; i < num.length(); ++i) @@ -522,10 +522,15 @@ String ShiftLeft2(String num) if (c == '.') { - num[i] = num[i-1]; - num[i-1] =num[i-2]; - num[i-2] = '.'; - return num; + String degrees = num.substring(0,i-2); + double deg = degrees.toDouble(); + String part = num.substring(i-2); + double dPart = part.toDouble(); + double sixty = 60.0; + dPart = dPart /sixty; + deg += dPart; + String degrees2 = String(deg,7); + return degrees2; } } return "Error"; @@ -618,7 +623,7 @@ void GetGPS() { // Telemetry split(nmea); - json = "{\"geolocation\":{"; + json = "{"; json += "\"lat\":"; if(strings[lattIndex+1]=="S") { @@ -636,7 +641,7 @@ void GetGPS() json += "\"alt\":"; json += strings[heightIndex]; //json += strings[heightIndex+1]; - json += "}}"; + json += "}"; result = json; } } diff --git a/Azure_IoT_Hub_GPS/iot_configs.h b/Azure_IoT_Hub_GPS/iot_configs.h index 78a7d0e..ee1cc73 100644 --- a/Azure_IoT_Hub_GPS/iot_configs.h +++ b/Azure_IoT_Hub_GPS/iot_configs.h @@ -1,14 +1,14 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // SPDX-License-Identifier: MIT -#define IOT_CONFIG_WIFI_SSID "APQLZM" -#define IOT_CONFIG_WIFI_PASSWORD "silly1371" +#define IOT_CONFIG_WIFI_SSID "" +#define IOT_CONFIG_WIFI_PASSWORD "" // Azure IoT -#define IOT_CONFIG_IOTHUB_FQDN "AzPicoGPDHub1.azure-devices.net" -#define IOT_CONFIG_DEVICE_ID "azpicogpsdev1" -#define IOT_CONFIG_DEVICE_KEY "sS6VTMfqcoyePD2ohYOItPJTfvs3RCKaLQIWsNEwCcE=" +#define IOT_CONFIG_IOTHUB_FQDN <"HUB PATH>" +#define IOT_CONFIG_DEVICE_ID ">" +#define IOT_CONFIG_DEVICE_KEY "" // Publish 1 message every 2 seconds -#define TELEMETRY_FREQUENCY_MILLISECS 2000 +#define TELEMETRY_FREQUENCY_MILLISECS 10000 diff --git a/BluetoothGPS/BluetoothGPS.ino b/BluetoothGPS/BluetoothGPS.ino index 63a5aea..42e85ee 100644 --- a/BluetoothGPS/BluetoothGPS.ino +++ b/BluetoothGPS/BluetoothGPS.ino @@ -95,8 +95,8 @@ void split(String string) } } -// NMEA latt,long values ar 100x so just shift decimal point left 2 in the string -// Could convert to double then divide by 100 but want as string +// THE FOLLOWING HAS BEEN UPDATED (CORRECTED): +//See https://davidjones.sportronics.com.au/web/GPS-NMEA_101-web.html String ShiftLeft2(String num) { for (int i = 0; i < num.length(); ++i) @@ -105,16 +105,20 @@ String ShiftLeft2(String num) if (c == '.') { - num[i] = num[i-1]; - num[i-1] =num[i-2]; - num[i-2] = '.'; - return num; + String degrees = num.substring(0,i-2); + double deg = degrees.toDouble(); + String part = num.substring(i-2); + double dPart = part.toDouble(); + double sixty = 60.0; + dPart = dPart /sixty; + deg += dPart; + String degrees2 = String(deg,7); + return degrees2; } } return "Error"; } - void loop() { if (SerialBT.available()) diff --git a/LocationGPS/LocationGPS.ino b/LocationGPS/LocationGPS.ino index 818f929..bd15ba9 100644 --- a/LocationGPS/LocationGPS.ino +++ b/LocationGPS/LocationGPS.ino @@ -51,7 +51,9 @@ void setup() { Serial2.setTX(TXD2); Serial2.begin(9600); Serial.begin(9600); + while(!Serial); delay(1000); + while(!Serial2); } #define bufferIndexMax 12 @@ -85,8 +87,8 @@ void split(String string) } } -// NMEA latt,long values ar 100x so just shift decimal point left 2 in the string -// Could convert to double then divide by 100 but want as string +// THE FOLLOWING HAS BEEN UPDATED (CORRECTED): +//See https://davidjones.sportronics.com.au/web/GPS-NMEA_101-web.html String ShiftLeft2(String num) { for (int i = 0; i < num.length(); ++i) @@ -95,10 +97,15 @@ String ShiftLeft2(String num) if (c == '.') { - num[i] = num[i-1]; - num[i-1] =num[i-2]; - num[i-2] = '.'; - return num; + String degrees = num.substring(0,i-2); + double deg = degrees.toDouble(); + String part = num.substring(i-2); + double dPart = part.toDouble(); + double sixty = 60.0; + dPart = dPart /sixty; + deg += dPart; + String degrees2 = String(deg,7); + return degrees2; } } return "Error"; @@ -281,9 +288,11 @@ void loop() { if(run) { - GetNMEASentence(); + GetNMEASentence();; if (result.length() >0) + { Serial.println(result); + } } } diff --git a/USART1Echo/USART1Echo.ino b/USART1Echo/USART1Echo.ino index 67969e5..130229e 100644 --- a/USART1Echo/USART1Echo.ino +++ b/USART1Echo/USART1Echo.ino @@ -10,13 +10,18 @@ void setup() { Serial2.begin(9600); Serial.begin(9600); delay(1000); + while(!Serial){}; + Serial.println("Started 1"); + while(!Serial2){}; + Serial.println("Started 2"); } void loop() { if (Serial.available()) { - Serial2.write(Serial.read(); - + + Serial2.write(Serial.read()); + /* if (!Serial2.available()) { } @@ -24,6 +29,20 @@ void loop() { { char c1 = Serial2.read(); Serial.write(c1); - }; + };*/ + } + if (Serial2.available()) + { + + Serial.write(Serial2.read()); + /* + if (!Serial2.available()) + { + } + while(Serial2.available()) + { + char c1 = Serial2.read(); + Serial.write(c1); + };*/ } } diff --git a/read-d2c-messages/obj/Debug/netcoreapp3.1/.NETCoreApp,Version=v3.1.AssemblyAttributes.cs b/read-d2c-messages-Net6/obj/Debug/net6.0/.NETCoreApp,Version=v6.0.AssemblyAttributes.cs similarity index 62% rename from read-d2c-messages/obj/Debug/netcoreapp3.1/.NETCoreApp,Version=v3.1.AssemblyAttributes.cs rename to read-d2c-messages-Net6/obj/Debug/net6.0/.NETCoreApp,Version=v6.0.AssemblyAttributes.cs index 1b9b2f8..ed92695 100644 --- a/read-d2c-messages/obj/Debug/netcoreapp3.1/.NETCoreApp,Version=v3.1.AssemblyAttributes.cs +++ b/read-d2c-messages-Net6/obj/Debug/net6.0/.NETCoreApp,Version=v6.0.AssemblyAttributes.cs @@ -1,4 +1,4 @@ // using System; using System.Reflection; -[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v3.1", FrameworkDisplayName = ".NET Core 3.1")] +[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] diff --git a/read-d2c-messages/obj/Debug/netcoreapp3.1/read-d2c-messages.AssemblyInfo.cs b/read-d2c-messages-Net6/obj/Debug/net6.0/read-d2c-Messages-Net6.AssemblyInfo.cs similarity index 88% rename from read-d2c-messages/obj/Debug/netcoreapp3.1/read-d2c-messages.AssemblyInfo.cs rename to read-d2c-messages-Net6/obj/Debug/net6.0/read-d2c-Messages-Net6.AssemblyInfo.cs index cfa7929..832d063 100644 --- a/read-d2c-messages/obj/Debug/netcoreapp3.1/read-d2c-messages.AssemblyInfo.cs +++ b/read-d2c-messages-Net6/obj/Debug/net6.0/read-d2c-Messages-Net6.AssemblyInfo.cs @@ -10,12 +10,12 @@ using System; using System.Reflection; -[assembly: System.Reflection.AssemblyCompanyAttribute("read-d2c-messages")] +[assembly: System.Reflection.AssemblyCompanyAttribute("read-d2c-Messages-Net6")] [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] [assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")] -[assembly: System.Reflection.AssemblyProductAttribute("read-d2c-messages")] -[assembly: System.Reflection.AssemblyTitleAttribute("read-d2c-messages")] +[assembly: System.Reflection.AssemblyProductAttribute("read-d2c-Messages-Net6")] +[assembly: System.Reflection.AssemblyTitleAttribute("read-d2c-Messages-Net6")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] // Generated by the MSBuild WriteCodeFragment class. diff --git a/read-d2c-messages-Net6/obj/Debug/net6.0/read-d2c-Messages-Net6.AssemblyInfoInputs.cache b/read-d2c-messages-Net6/obj/Debug/net6.0/read-d2c-Messages-Net6.AssemblyInfoInputs.cache new file mode 100644 index 0000000..806ae95 --- /dev/null +++ b/read-d2c-messages-Net6/obj/Debug/net6.0/read-d2c-Messages-Net6.AssemblyInfoInputs.cache @@ -0,0 +1 @@ +fa45f9b7ee6e127a2de2ecb0ec05441354260657 diff --git a/read-d2c-messages-Net6/obj/Debug/net6.0/read-d2c-Messages-Net6.GeneratedMSBuildEditorConfig.editorconfig b/read-d2c-messages-Net6/obj/Debug/net6.0/read-d2c-Messages-Net6.GeneratedMSBuildEditorConfig.editorconfig new file mode 100644 index 0000000..d7ae77f --- /dev/null +++ b/read-d2c-messages-Net6/obj/Debug/net6.0/read-d2c-Messages-Net6.GeneratedMSBuildEditorConfig.editorconfig @@ -0,0 +1,11 @@ +is_global = true +build_property.TargetFramework = net6.0 +build_property.TargetPlatformMinVersion = +build_property.UsingMicrosoftNETSdkWeb = +build_property.ProjectTypeGuids = +build_property.InvariantGlobalization = +build_property.PlatformNeutralAssembly = +build_property.EnforceExtendedAnalyzerRules = +build_property._SupportedPlatformList = Linux,macOS,Windows +build_property.RootNamespace = read-d2c-Messages-Net6 +build_property.ProjectDir = c:\Users\david\Documents\Arduino\RPIPicoWGPSandBT\read-d2c-messages-Net6\ diff --git a/read-d2c-messages-Net6/obj/Debug/net6.0/read-d2c-Messages-Net6.csproj.AssemblyReference.cache b/read-d2c-messages-Net6/obj/Debug/net6.0/read-d2c-Messages-Net6.csproj.AssemblyReference.cache new file mode 100644 index 0000000..f761697 Binary files /dev/null and b/read-d2c-messages-Net6/obj/Debug/net6.0/read-d2c-Messages-Net6.csproj.AssemblyReference.cache differ diff --git a/read-d2c-messages/obj/Debug/netcoreapp3.1/read-d2c-messages.AssemblyInfoInputs.cache b/read-d2c-messages/obj/Debug/netcoreapp3.1/read-d2c-messages.AssemblyInfoInputs.cache deleted file mode 100644 index 4de155c..0000000 --- a/read-d2c-messages/obj/Debug/netcoreapp3.1/read-d2c-messages.AssemblyInfoInputs.cache +++ /dev/null @@ -1 +0,0 @@ -b0f6916f754434f73f49b8fc428a5a49c82ae35d diff --git a/read-d2c-messages/obj/Debug/netcoreapp3.1/read-d2c-messages.GeneratedMSBuildEditorConfig.editorconfig b/read-d2c-messages/obj/Debug/netcoreapp3.1/read-d2c-messages.GeneratedMSBuildEditorConfig.editorconfig deleted file mode 100644 index eaab567..0000000 --- a/read-d2c-messages/obj/Debug/netcoreapp3.1/read-d2c-messages.GeneratedMSBuildEditorConfig.editorconfig +++ /dev/null @@ -1,3 +0,0 @@ -is_global = true -build_property.RootNamespace = read-d2c-messages -build_property.ProjectDir = c:\Users\david\Documents\Arduino\RPIPicoWGPSandBT\read-d2c-messages\ diff --git a/read-d2c-messages/obj/Debug/netcoreapp3.1/read-d2c-messages.csproj.AssemblyReference.cache b/read-d2c-messages/obj/Debug/netcoreapp3.1/read-d2c-messages.csproj.AssemblyReference.cache deleted file mode 100644 index c2fff4d..0000000 Binary files a/read-d2c-messages/obj/Debug/netcoreapp3.1/read-d2c-messages.csproj.AssemblyReference.cache and /dev/null differ