Adafruit Ultimate GPS - weekday
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- robertwrand
- Posts: 22
- Joined: Fri Jan 03, 2014 8:24 pm
Adafruit Ultimate GPS - weekday
Hello, didn't find weekday in the Ultimate GPS doco, but I might have missed it. What function call for weekday? Thanks!
- Franklin97355
- Posts: 23910
- Joined: Mon Apr 21, 2008 2:33 pm
Re: Adafruit Ultimate GPS - weekday
Do you know if that is available in a GPS sentence? If so which one? Here is a way to compute it from date and time. It's not Arduino code so it would need to be ported over.
Code: Select all
hrs = b1 - $30 * 10 + b2 - $30 ; convert to decimal
mins = b3 - $30 * 10 + b4 - $30 ; convert to decimal
secs = b5 - $30 * 10 + b6 - $30 ; convert to decimal
dd = b8 - $30 * 10 + b9 - $30 ; convert to decimal
mm = b10 - $30 * 10 + b11 - $30 ; convert to decimal
yy = b12 - $30 * 10 + b13 - $30 ; convert to decimal
' Calculate day of week from date using Doomsday algorithm
lookup mm,(0,3,28,7,4,2,6,4,1,5,3,7,5),b7
b8 = yy // 4
if b8 <> 0 then gps2
if mm >= 3 then gps2
b7 = b7 + 1
GPS2:
b9 = yy / 12
b10 = yy // 12
b11 = b10 / 4
b12 = b9 + b10 + b11 + 2 // 7
day = dd + b12 + 7 - b7 // 7 + 1
Please be positive and constructive with your questions and comments.