And what is the RAM usage of each sketch?
i dont know, am not sure how to check.. how does this make a difference?
so i made some minor adjustments to the sketch and now, it prints on the OLED..However, i cannot get the serial to print out the Serial.print();
for example,
Serial.println("Adafruit GPS library basic test!");
this does not show up at the beginning of the serial monitor.
$,145.87,0015,,,*E,,0,0,,,M,,M,,*49
$GPGSA,A,1,,,,,,,,,,,,,,,*1E
$GPGSV,1,1,02,10,,,23,05,,,23*7F
$GPRMC,162619.082,V,,,,,0.00,145.87,0015,,,*E,,0,0,,,M,,M,,*49
$GPGSA,A,1,,,,,,,,,,,,,,,*1E
$GPGSV,1,1,02,10,,,23,05,,,23*7F
$GPRMC,162619.082,V,,,,,0.00,145.87,0015,,,*E
this is what it shows at the start.
the code is bellow
// Test code for Adafruit GPS modules using MTK3329/MTK3339 driver
//
// This code shows how to listen to the GPS module in an interrupt
// which allows the program to have more 'freedom' - just parse
// when a new NMEA sentence is available! Then access data when
// desired.
//
// Tested and works great with the Adafruit Ultimate GPS module
// using MTK33x9 chipset
// ------> http://www.adafruit.com/products/746
// Pick one up today at the Adafruit electronics shop
// and help support open source hardware & software! -ada
//This code is intended for use with Arduino Leonardo and other ATmega32U4-based Arduinos
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <Adafruit_GPS.h>
#define GPSECHO true
#if (SSD1306_LCDHEIGHT != 64)
#include <SoftwareSerial.h>
#error("Height incorrect, please fix Adafruit_SSD1306.h!");
#endif
//things i added to the working code
//**************************************************
#define OLED_RESET 4
Adafruit_SSD1306 display(OLED_RESET);
//**************************************************
SoftwareSerial mySerial(2, 3);
Adafruit_GPS GPS(&mySerial);
void setup()
{
Serial.begin(115200);
Serial.println("Adafruit GPS library basic test!");
//things i added to the working code
//******************************
display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
display.display();
delay(2000);
display.clearDisplay();
display.setTextColor(WHITE);
display.setTextSize(1);
display.setCursor(0,30);
display.println("test print");
display.setTextColor(WHITE);
display.display();
delay(2000);
display.clearDisplay();
//
//******************************
// 9600 NMEA is the default baud rate for Adafruit MTK GPS's- some use 4800
GPS.begin(9600);
// uncomment this line to turn on RMC (recommended minimum) and GGA (fix data) including altitude
GPS.sendCommand(PMTK_SET_NMEA_OUTPUT_RMCGGA);
// uncomment this line to turn on only the "minimum recommended" data
//GPS.sendCommand(PMTK_SET_NMEA_OUTPUT_RMCONLY);
// For parsing data, we don't suggest using anything but either RMC only or RMC+GGA since
// the parser doesn't care about other sentences at this time
// Set the update rate
GPS.sendCommand(PMTK_SET_NMEA_UPDATE_1HZ); // 1 Hz update rate
// For the parsing code to work nicely and have time to sort thru the data, and
// print it out we don't suggest using anything higher than 1 Hz
// Request updates on antenna status, comment out to keep quiet
GPS.sendCommand(PGCMD_ANTENNA);
delay(1000);
// Ask for firmware version
// mySerial.println(PMTK_Q_RELEASE);
}
uint32_t timer = millis();
void loop() // run over and over again
{
Serial.print("stage1");
// display.clearDisplay();
display.setTextSize(1);
display.setTextColor(WHITE);
char c = GPS.read();
// if you want to debug, this is a good time to do it!
if ((c) && (GPSECHO))
Serial.write(c);
// if a sentence is received, we can check the checksum, parse it...
if (GPS.newNMEAreceived()) {
if (!GPS.parse(GPS.lastNMEA())) // this also sets the newNMEAreceived() flag to false
return; // we can fail to parse a sentence in which case we should just wait for another
}
// if millis() or timer wraps around, we'll just reset it
if (timer > millis()) timer = millis();
// approximately every 2 seconds or so, print out the current stats
if (millis() - timer > 2000) {
timer = millis(); // reset the timer
delay(1000);
Serial.print("\nTime: ");
//*******************************************
display.clearDisplay(); // important
display.setTextSize(1);
display.setTextColor(WHITE);
display.setCursor(10,3);
display.println(GPS.hour, DEC);
display.setCursor(30,3);
display.println(GPS.minute, DEC);
display.setCursor(10,20);
display.println(GPS.day, DEC);
display.setCursor(30,20);
display.println(GPS.month, DEC);
display.setCursor(50,20);
display.println(GPS.year, DEC);
display.display();
// display.display();
//*******************************************
Serial.print((GPS.hour ) % 24 , DEC);
Serial.print(':');
Serial.print(GPS.minute, DEC);
Serial.print(':');
Serial.print(GPS.seconds, DEC);
Serial.print('.');
Serial.println(GPS.milliseconds);
Serial.print("Date: ");
if((GPS.hour + 1 ) % 24 < GPS.hour){
GPS.day = GPS.day + 1;
}
Serial.print(GPS.day, DEC);
Serial.print('/');
Serial.print(GPS.month, DEC);
Serial.print("/20");
Serial.println(GPS.year, DEC);
Serial.print("Fix: ");
Serial.print((int)GPS.fix);
Serial.print(" quality: ");
Serial.println((int)GPS.fixquality);
if (GPS.fix) {
Serial.print("Location: ");
Serial.print(GPS.latitude, 4);
Serial.print(GPS.lat);
Serial.print(", ");
Serial.print(GPS.longitude, 4);
Serial.println(GPS.lon);
Serial.print("Speed (Km/h: ");
Serial.println(GPS.speed* 1.852);
Serial.print("Angle: ");
Serial.println(GPS.angle);
Serial.print("Altitude: ");
Serial.println(GPS.altitude);
Serial.print("Satellites: ");
Serial.println((int)GPS.satellites);
}
}
}
so yeah, currently, the serial.print is not working