I am using an Arduino MKR NB 1500 with a Hologram SIM card. The SIM card is configured properly and the Arduino can connect to the network without any issues other than maybe a weak connection at times.
What I Need
I am using the RecieveSMS example code from the MKRNB library. All I need the code to do is Recieve and display sent SMS to Serial and be able to continually display SMS as they are sent during runtime.
The Problem
When I send a SMS message the Arduino after uploading the program the SMS is not seen by the " sms.available() " function. When I restart the Arduino or reupload the code the SMS is recieved and displayed but will not recieve any further SMS until the Arduino is restarted or the code is uploaded again.
What I Tried
I tried removing the delay at the bottom of the main loop so that the " sms.available() " function is checked all the time - This did not work
I tried checking if the program was getting stuck using print statements and the " sms.available() " function works fine and so does the rest of the code.
I tried not using the " sms.available() " function at all and just constantly try to read messages over and over and this also did not work.
I tried recieving SMS using AT commands by sending them using the SerialSARAPassThrough example code. I was able to connect to the Hologram network, check the connection and configure for SMS but I did not successfully recieve any SMS. The only way I successfully recieved SMS is using the RecieveSMS example code but not in the correct way.
Conclusion
I am unsure what the issue is if it is the example code, the source MKRNB library code or the Hologram network. I am also unsure if the solution is obvious and I am missing it entirely. If I cannot get this to Recieve SMS are there any other arduino boards that can be recommended?
UPDATE 1
Currently no messages are being displayed even after restarting the arduino. I had sent multiple messages and none were detected. I sent the AT command AT+CPMS? and got the following response:
+CPMS: "SM",10,10,"SM",10,10,"SM",10,10
So clearly the messages are recieved but the sms.available() function is not seeing them nor are they getting printed by any other means.
UPDATE 2
After running the previous AT command the RecieveSMS example code now works again somehow and displayed all of the sent messages all in one go. It is very strange as to what is happening
UPDATE 3
I have gotten the arduino to recieve and display SMS messages during runtime by running the nbAcess.begin() function again every loop iteration, which explains restarting the arduino resulting in displaying SMS messages by running that function again.
However this is very slow considering it has to connect to the network each time every iteration. There should be a better solution with this in mind. There are no functions in the NB library for a simple refresh so I am stuck on what to try next.