Hi again,
Back trying to figure this out....a summary...want to connect a LCD shield to the Ultimate GPS logger shield, display speed on LCD and log time and speed.. "how hard could it be...."
Started using an UNO and got all seperate pieces working...But not all at same time...Of course thinking that I made something wrong in the sketch...
Then it turns out the memory of the UNO is too small...So I go and get a MEGA instead..."how hard can it be..."
No I can get the "Hello World" sketch and "Cardinfo" working on the mega...but not the SD logger card...
When adding this line: "while (!card.init(SPI_HALF_SPEED, 10, 11, 12, 13)) {"
I get error: "'card' was not declared in this scope"
So I add the line: "Sd2Card card;" from the working "Cardinfo" example..
Then I get this error: "at end of input expected unqualified-id before string constant" and marked this part: "SIGNAL(TIMER0_COMPA_vect) {"
Any suggestions!?
Merging two working sketches into one??
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- adafruit_support_bill
- Posts: 88096
- Joined: Sat Feb 07, 2009 10:11 am
Re: Merging two working sketches into one??
Please post the complete code and the complete error text.
- brandtz
- Posts: 27
- Joined: Fri Aug 17, 2012 4:49 am
Re: Merging two working sketches into one??
This is the latest code...and error text...
- Attachments
-
- Megaproj error 20150645.txt
- (1.12 KiB) Downloaded 162 times
-
- Megaproj 20150645.txt
- (6.56 KiB) Downloaded 162 times
- adafruit_support_bill
- Posts: 88096
- Joined: Sat Feb 07, 2009 10:11 am
Re: Merging two working sketches into one??
You are missing a closing bracket "}" somewhere in your setup() function.
- brandtz
- Posts: 27
- Joined: Fri Aug 17, 2012 4:49 am
Re: Merging two working sketches into one??
Embarassing...thanks...
Got the compiler to like the code and upload now...but using Serial to looks whats happening...I can't the the output of these lines: "Serial.print("Speed (knots): "); Serial.println(GPS.speed);"
The only thing I get in Serial window is:
"Ultimate GPSlogger Shield
Took 73 ms
Writing to GPSLOG04.TXT
Ready!"
Got the compiler to like the code and upload now...but using Serial to looks whats happening...I can't the the output of these lines: "Serial.print("Speed (knots): "); Serial.println(GPS.speed);"
The only thing I get in Serial window is:
"Ultimate GPSlogger Shield
Took 73 ms
Writing to GPSLOG04.TXT
Ready!"
- adafruit_support_bill
- Posts: 88096
- Joined: Sat Feb 07, 2009 10:11 am
Re: Merging two working sketches into one??
You are using a Mega now, so software serial is restricted to pins that support pin-change interrupts:
http://www.arduino.cc/en/Reference/SoftwareSerial
http://www.arduino.cc/en/Reference/SoftwareSerial
Not all pins on the Mega and Mega 2560 support change interrupts, so only the following can be used for RX: 10, 11, 12, 13, 14, 15, 50, 51, 52, 53, A8 (62), A9 (63), A10 (64), A11 (65), A12 (66), A13 (67), A14 (68), A15 (69).
- brandtz
- Posts: 27
- Joined: Fri Aug 17, 2012 4:49 am
Re: Merging two working sketches into one??
Ok.....I have no idea what that means and how to handle it...did also try to read through the link you sent...
Its like I fix one thing, with the great help from you..., and another pops up in its place..
Remember also that the GPS has its little switch between "SoftSerial and Direct"...does that also have something to do with all this....?!
Is there someone out there that I just could ask to put all these things together and take a "leap" in the process rather than my current "ant steps"..?!
The goal, iterated, is...Mega, GPS Ultimate Logger, LCD panel. Log and Print speed on LCD. When all that is done I will try to add logging also a loadcell values, I have already the amplifier and the loadcell.....
Its like I fix one thing, with the great help from you..., and another pops up in its place..
Remember also that the GPS has its little switch between "SoftSerial and Direct"...does that also have something to do with all this....?!
Is there someone out there that I just could ask to put all these things together and take a "leap" in the process rather than my current "ant steps"..?!
The goal, iterated, is...Mega, GPS Ultimate Logger, LCD panel. Log and Print speed on LCD. When all that is done I will try to add logging also a loadcell values, I have already the amplifier and the loadcell.....
- adafruit_support_bill
- Posts: 88096
- Joined: Sat Feb 07, 2009 10:11 am
Re: Merging two working sketches into one??
You currently have a SoftwareSerial port on pins 7 and 8 which do not support SoftwareSerial on the Mega.
The best solution is the one described in the Shield Compatibility Guide:
https://learn.adafruit.com/adafruit-shi ... l-variants
Code: Select all
SoftwareSerial mySerial(8, 7);
https://learn.adafruit.com/adafruit-shi ... l-variants
- brandtz
- Posts: 27
- Joined: Fri Aug 17, 2012 4:49 am
Re: Merging two working sketches into one??
So lets see now..Tried changing like this:
//SoftwareSerial mySerial(8, 7);
SoftwareSerial mySerial();
#define mySerial Serial1
But still nothing on the serial read..
Changed to:
SoftwareSerial mySerial(50, 51); (using two numbers from an earlier reply you sent me)
Found this AGAIN, see earlier in this thread, and what led me to changing in the Sd2Card.h...I think you said not to change in thoes files...SHOULD I try that now?!
"For the SD card, the following may be tried, in decreasing order of recommendation:
Use the Adafruit SD library, specifying pin 10 for chip select, 11 for MOSI, 12 for MISO and 13 for SCK.
Edit the file utility/Sd2Card.h in the default Arduino SD library, changing line 42 to read "#define MEGA_SOFT_SPI 1" (default is 0)."
//SoftwareSerial mySerial(8, 7);
SoftwareSerial mySerial();
#define mySerial Serial1
But still nothing on the serial read..
Changed to:
SoftwareSerial mySerial(50, 51); (using two numbers from an earlier reply you sent me)
Found this AGAIN, see earlier in this thread, and what led me to changing in the Sd2Card.h...I think you said not to change in thoes files...SHOULD I try that now?!
"For the SD card, the following may be tried, in decreasing order of recommendation:
Use the Adafruit SD library, specifying pin 10 for chip select, 11 for MOSI, 12 for MISO and 13 for SCK.
Edit the file utility/Sd2Card.h in the default Arduino SD library, changing line 42 to read "#define MEGA_SOFT_SPI 1" (default is 0)."
- adafruit_support_bill
- Posts: 88096
- Joined: Sat Feb 07, 2009 10:11 am
Re: Merging two working sketches into one??
That is not the same as what the guide says:So lets see now..Tried changing like this:
//SoftwareSerial mySerial(8, 7);
SoftwareSerial mySerial();
#define mySerial Serial1
Code: Select all
//SoftwareSerial mySerial(8, 7);
#define mySerial Serial1
Adafruit_GPS GPS(&mySerial);
Just changing the numbers in the code won't work since the shield is not connected to those pins. Please follow the advice in the guide above:Changed to:
SoftwareSerial mySerial(50, 51); (using two numbers from an earlier reply you sent me)
- brandtz
- Posts: 27
- Joined: Fri Aug 17, 2012 4:49 am
Re: Merging two working sketches into one??
OK...changed to:
#define mySerial Serial1
Adafruit_GPS GPS(&mySerial);
On the serial it still says:
Ultimate GPSlogger Shield
0.00
Took 62 ms
Writing to GPSLOG22.TXT
Ready!
#define mySerial Serial1
Adafruit_GPS GPS(&mySerial);
On the serial it still says:
Ultimate GPSlogger Shield
0.00
Took 62 ms
Writing to GPSLOG22.TXT
Ready!
- adafruit_support_bill
- Posts: 88096
- Joined: Sat Feb 07, 2009 10:11 am
Re: Merging two working sketches into one??
Have you added the jumpers?
- brandtz
- Posts: 27
- Joined: Fri Aug 17, 2012 4:49 am
Re: Merging two working sketches into one??
Hmmm...Didn't see anything about jumpers...guess due to fact I wouldn't know how to apply that...so no...haven't done the jumpers, where is the instruction of that!?
- adafruit_support_bill
- Posts: 88096
- Joined: Sat Feb 07, 2009 10:11 am
Re: Merging two working sketches into one??
Please refer to the Shield Compatibility link posted earlier: https://learn.adafruit.com/adafruit-shi ... l-variants
Use 'Soft Serial' switch setting.
Jumper from pin 8 on the shield to RX1 on the Mega
Jumper from pin 7 on the shield to TX1 on the Mega
In your code, don't use SoftwareSerial. Instead, define mySerial as Serial1:
- brandtz
- Posts: 27
- Joined: Fri Aug 17, 2012 4:49 am
Re: Merging two working sketches into one??
GREAT!! Works fine after the "jumpers"...I did not get that those where "physical" ones...THAT'S how newbie I am...
Can now move on trying to get the load cells connected...Jiihaa!
Thanks for your help! Hopefully this thread would also help others.
Can now move on trying to get the load cells connected...Jiihaa!
Thanks for your help! Hopefully this thread would also help others.
Please be positive and constructive with your questions and comments.