New Homepage Forums Special Shields clock shield problem

This topic contains 2 replies, has 1 voice, and was last updated by avatar KeithL 8 months ago. This post has been viewed 75 times

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #319035
    avatarKeithL
    Participant

    Hello –

    I’m using the 1sheeld+ on a Uno R3, with Android 5.1 on my phone (an LG G4). I’m developing an application that will monitor several analog inputs and send a report of their status via SMS. To test it, I’m using the Terminal shield first (in lieu of SMS), and I’ve had problems with it, so, I broke it down into its simplest form. The attached code merely sends the time every 10 seconds. It always fails after 15 minutes or so. Usually, the time will freeze, and sometimes, it will just quit sending any text to the terminal. The 1shield+ remains connected to the phone (blue light on steady). I notice that when the time fails, the yellow “RxD” light on the 1sheeld+ board stops blinking, but the green “TxD” continues to flash every time a message is sent to the terminal. If the text strings stop coming into the terminal, then both LEDs remain off (and the blue light is still on steady). At this point, if I hit the reset on the Uno board, text strings will start coming in again on the terminal, but the time is always 0:00:00. Any ideas whats going on?

    Thanks!

    #319240
    avatarKeithL
    Participant

    Some more details: After resetting the Uno R3, the terminal kept displaying messages all day with the time continuing to be 0:00:00, so, the terminal doesn’t seem to be the problem. I left it to run while I took my phone out of range for a couple hours (the blue light was flashing when I returned, of course), and when I re-connected, the yellow TxD light started flashing again, and once again, the correct time was being displayed on the terminal messages.

    #319244
    avatarKeithL
    Participant

    Just noticed the code didn’t post earlier. Here it is:

    #define CUSTOM_SETTINGS
    #define INCLUDE_SMS_SHIELD
    #define INCLUDE_CLOCK_SHIELD
    #define INCLUDE_TERMINAL_SHIELD

    /* Include 1Sheeld library. */
    #include <OneSheeld.h>

    boolean toggle0 = 0;

    /* Define some variables for the date and time. */
    byte hour, minute, second;

    String SMS_message;

    void setup()
    {
    /* Start communication. */
    OneSheeld.begin();

    analogReference(EXTERNAL);

    pinMode(13, OUTPUT);

    }

    void loop()
    {

    /* get the time when our delay runs out */
    delay(10000);

    Clock.queryDateAndTime();

    hour = Clock.getHours();
    minute = Clock.getMinutes();
    second = Clock.getSeconds();

    SMS_message = “”;
    SMS_message += String(hour);
    SMS_message += ‘:’;

    if(minute < 10)
    SMS_message += ‘0’; // inert a leading zero in the time if we need to

    SMS_message += String(minute);

    SMS_message += ‘:’;

    if(second < 10)
    SMS_message += ‘0’; // inert a leading zero in the time if we need to

    SMS_message += String(second);

    SMS_message += ‘\n’;

    Terminal.print(SMS_message);
    }

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.