Pages: [1]   Go Down
Author Topic: New GPS Issue #2  (Read 1185 times)
0 Members and 1 Guest are viewing this topic.
Anaheim CA.
Offline Offline
Faraday Member
**
Karma: 44
Posts: 2811
...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

EDIT, Should I be reading about typecast and lacking that a cast? It's been bothering me since I posted this thing...
In attempting to botch some apparently simple instruction From the tinyGPS Page, http://arduiniana.org/libraries/tinygps/, I did this:
Code:
// First Attempt at My GPS Clock
#include <TinyGPS.h>
#include <UTFT.h>
extern uint8_t SmallFont[];
UTFT myGLCD(ITDB32S,38,39,40,41);   // Mega2560
TinyGPS gps;
//  Other init stuff to go here
//
//
//  Works ... so far W/O the display, that's after it compiles
//
//
//
void setup()
{
  // Do some thing here
  Serial.begin(115200);  //Remove when GLCD is working
  Serial1.begin(9600);  // 9600 baud for Skylabs SKM53
  //Serial1.begin(4800);  // 4800 baud for uBlox-6_1?
  myGLCD.InitLCD();
  myGLCD.setFont(SmallFont);
  myGLCD.clrScr();
  // Other setup stuff to go here too
}


/*Feed the object serial NMEA data one character at a time using the encode() method.
 (TinyGPS does not handle retrieving serial data from a GPS unit.)
 When encode() returns “true”, a valid sentence has just changed the TinyGPS object’s internal state. For example:
 */
void loop()
{
  while (Serial1.available())
  {
    int c = Serial1.read();
    if (gps.encode(c))

    {
      // process new gps info here
      int year;
      byte month, day, hour, minute, second, hundredths;
      unsigned long fix_age;
      gps.crack_datetime(&year, &month, &day,
      &hour, &minute, &second, &hundredths, &fix_age);
      myGLCD.clrScr();
      myGLCD.print("Date   :",8 ,8);
 **Error**     myGLCD.print(month,8,40); // 'invalid conversion from 'byte' to 'const char*'
      myGLCD.print("/",8 ,56);  // Error above is one that google didn't help with or did this forum using the error message as the search term
      myGLCD.print(day,8,64);
      myGLCD.print(", 20",8,80);
      myGLCD.print(year,5,88);  
    }
  }
}
    // myGLCD print example:  'myGLCD.print(string, Upper left corner Row, Upper Left corner Column)' and there are
    // other options for color and numeric length and fill color
I'm Kinda lost AGAIN,
If there anyone to take mercy on an old noob (oxymoron?)

Bob
« Last Edit: October 04, 2012, 03:29:07 am by Docedison » Logged

--> WA7EMS <--
“The solution of every problem is another problem.” -Johann Wolfgang von Goethe
I do answer technical questions PM'd to me with whatever is in my clipboard

Massachusetts, USA
Offline Offline
Tesla Member
***
Karma: 180
Posts: 8102
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Code:
      Serial.print(('month'),('day'), ("20"), ('year')); 

You probably mean:
Code:
      Serial.print(month);
      Serial.print("/");
      Serial.print(day);
      Serial.print(", 20");
      Serial.print(year); 
(You can only print one variable or constant at a time.)
Logged

Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Anaheim CA.
Offline Offline
Faraday Member
**
Karma: 44
Posts: 2811
...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes, I did, especially after your suggestion worked  I had been aware of issues 'trying' to print more on a line but thought I did something wrong rather than run into a limitation? of Arduino's C implementation.
I tried to decipher the "Cuneiform of the Compiler"... and that is usually the extent of it, except the totally weird ones... Those mean I've dropped a semicolon. Dropped two once and the compiler insisted line 7 of a 12 line block comment was the offending line. Thank You Johnwasser

Bob
Logged

--> WA7EMS <--
“The solution of every problem is another problem.” -Johann Wolfgang von Goethe
I do answer technical questions PM'd to me with whatever is in my clipboard

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 551
Posts: 46224
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Code:
      myGLCD.print("Date   :",8 ,8);
 **Error**     myGLCD.print(month,8,40); // 'invalid conversion from 'byte' to 'const char*'
      myGLCD.print("/",8 ,56);  // Error above is one that google didn't help with or did this forum using the error message as the search term
The UTFT class does not, apparently, derive from the Print function, so the UTFT::print() method is not overloaded, like the Serial.print() or client.print() functions are. The UTFT::print() method expects the first argument to be a NULL terminated array of chars. month is NOT a NULL terminated array of chars, and the compiler is telling you that it has no idea how to convert a byte to a NULL terminated array of chars.

Fortunately, the sprintf() and itoa() functions do.
Logged

Anaheim CA.
Offline Offline
Faraday Member
**
Karma: 44
Posts: 2811
...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Paul, THANK YOU... It didn't make much sense at the time, although the guy (Hart) also used sprintf, I rather need the itoa function because Time will be a global function for several different functions that I have in mind for this device...

Bob
Logged

--> WA7EMS <--
“The solution of every problem is another problem.” -Johann Wolfgang von Goethe
I do answer technical questions PM'd to me with whatever is in my clipboard

Anaheim CA.
Offline Offline
Faraday Member
**
Karma: 44
Posts: 2811
...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

It was a case of what I harp on regularly... YES ME ",!," HAD I BUT READ THE MANUAL SUPPLIED WITH THE LIBRARY...  I can only surmise it was the sheer shock to find an accurate and truly helpful display MANUAL. UNHEARD Of...
I might have not spent several wasted hours trying to just get a sketch to compile. It seems the compiler is quite happy with myGLCD.printNumI(month,Xcol,Yrow);. I've not yet connected it to a display and GPS device. I had to take the GLCD shield and add stackable headers and an 8" extension cable for the GLCD so I can use the ports underneath the GLCD itself. The ITead shield if a great demo shield but Very little else without an intermediate shield or a 40 pin extension cable for the GLCD.
Now If... There Only was One More Really Fine Book... for "The Cuneiform of the Compiler" damn thing gives me nightmares...  <BFG>

Bob.
Logged

--> WA7EMS <--
“The solution of every problem is another problem.” -Johann Wolfgang von Goethe
I do answer technical questions PM'd to me with whatever is in my clipboard

Pages: [1]   Go Up
Jump to: