This is the first time I have ever tried an array... and I am only repeating the offending part of the program as it is too long (a successful marriage of a GPS sketch and a TFT Demo sketch both from Adafruit and working well. as is obvious tis is to simply convert UTC time from a GPS receiver to local (PDT) time, I'll worry about PST later as I need to get this working now before I can get to later
int hours = 0; //This works
These are the additions tonight. The only ones. If I change back the sketch to the point prior to this by changing the arrray reference to hours in the If statement it works
I've included my sorry code but I think it better to make something work before any other changes are made like moving most of this into functions so I can add some
more like temp, baro and hygro measurements as well as an X10 control function. Ultimately this will all be on a 32 PT SGC display by 4D Systems... One small thing at a time
I already have the others working except the X10 sketch. and I uploaded GPS_Time_Date_TFT_2_2_3
int hrs[24] = {16, 17, 18, 19, 20, 21, 22, 23, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}; //these work
int hours = (GPS.hour); // GMT is + 7 Hrs so move it off to a - 12 hour offset
/* 24 hour to 12 jour AM/PM conversion */
if ( hrs[hours] >= 12) // AM/PM Test // access the hrs array Bombs and I am sure I made the error here
GPS_Time_Date_TFT_2_3:169: error: 'hrs' was not declared in this scope // Compiler error message
And here I'm Stuck as can't see how I made a scope error... I think the array is so simple that someone is going to ask about what I have been reading besides books on C
I do have an additional question, would it have been better to use an Enum array?
Doc
GPS_Time_Date_TFT_2_3.ino (10.4 KB)