@@ -147,75 +147,6 @@ delay(3000);
147
147
148
148
void loop () {
149
149
150
- while (ss.available () > 0 ) // while data is available
151
- if (gps.encode (ss.read ())) // read gps data
152
- {
153
- Serial.print (" ----------------TRIED TO READ GPS AT LEAST_------------------------------------------------- ---- " );
154
-
155
- if (gps.location .isValid ()) // check whether gps location is valid
156
- {
157
- Serial.print (" ----------------LOCATION===VALID ------------------------------------------------- ---- " );
158
- latitude = gps.location .lat ();
159
- lat_str = String (latitude , 6 ); // latitude location is stored in a string
160
- longitude = gps.location .lng ();
161
- lng_str = String (longitude , 6 ); // longitude location is stored in a string
162
- }
163
- if (gps.date .isValid ()) // check whether gps date is valid
164
- {
165
- date_str = " " ;
166
- date = gps.date .day ();
167
- month = gps.date .month ();
168
- year = gps.date .year ();
169
- if (date < 10 )
170
- date_str = ' 0' ;
171
- date_str += String (date);// values of date,month and year are stored in a string
172
- date_str += " / " ;
173
-
174
- if (month < 10 )
175
- date_str += ' 0' ;
176
- date_str += String (month); // values of date,month and year are stored in a string
177
- date_str += " / " ;
178
- if (year < 10 )
179
- date_str += ' 0' ;
180
- date_str += String (year); // values of date,month and year are stored in a string
181
- }
182
- if (gps.time .isValid ()) // check whether gps time is valid
183
- {
184
- time_str = " " ;
185
- hour = gps.time .hour ();
186
- minute = gps.time .minute ();
187
- second = gps.time .second ();
188
- minute = (minute + 30 ); // converting to IST
189
- if (minute > 59 )
190
- {
191
- minute = minute - 60 ;
192
- hour = hour + 1 ;
193
- }
194
- hour = (hour + 5 ) ;
195
- if (hour > 23 )
196
- hour = hour - 24 ; // converting to IST
197
- if (hour >= 12 ) // checking whether AM or PM
198
- pm = 1 ;
199
- else
200
- pm = 0 ;
201
- hour = hour % 12 ;
202
- if (hour < 10 )
203
- time_str = ' 0' ;
204
- time_str += String (hour); // values of hour,minute and time are stored in a string
205
- time_str += " : " ;
206
- if (minute < 10 )
207
- time_str += ' 0' ;
208
- time_str += String (minute); // values of hour,minute and time are stored in a string
209
- time_str += " : " ;
210
- if (second < 10 )
211
- time_str += ' 0' ;
212
- time_str += String (second); // values of hour,minute and time are stored in a string
213
- if (pm == 1 )
214
- time_str += " PM " ;
215
- else
216
- time_str += " AM " ;
217
- }
218
- }
219
150
220
151
221
152
0 commit comments