New answers tagged

2

First, a few general notes: The difference between char str[2] and char* str = (char*) malloc(2) is irrelevant to you problem. It changes the place where the array is stored, the meaning of sizeof str, and malloc() will blow up your RAM if you call it repeatedly and forget to free(). In your code, sizeof(txt) is the constant 2: the actual size in bytes of ...


0

As others have pointed out, C strings are null-terminated. So to hold 2 characters of content you need a 3-byte array. Your code that reads the chacters into the buffer also needs to be changed. (That code isn't adding the required terminating null.) You should probably rewrite your code to use the strncat() function.


0

Display "waiting for sats" ... continue when a successful GPS signal is received You are (or the Arduino library you are using is) using the time.h library which starts on January 1st, 1970. If no adjustments are made, time.h will report January 1st, 1970. You are not (or the Arduino library you are using is not) waiting for a "good GPS ...


0

I'm guessing that the GPS module doesn't receive a time reading until it acquires a GPS lock. That can take many seconds. You haven't posted your code so we can't tell how you're handling the time reading. I would suggest checking for the midnight 1970 time (which is the UNIX "epoch time") and handling that with special-case code. If you're reading ...


3

A CPP file isn't an Arduino file. It doesn't know about anything Arduino-esque unless you tell it about it. The simplest way is to just add, at the top of the file: #include <Arduino.h>


0

Don't use listen() this way. It clears the receive buffer. You loose the data received before listen() call. You have only one SoftwareSerial instance so you don't need to call listen(). The listen() function clears the receive buffer because there is only one buffer for all SoftwareSerial instances.


Top 50 recent answers are included