Arduino api create note

I have been successful in creating a note with a simple program that creates a note using. I copied the create note function to a larger program that does some other things:

  1. initialize the card
  2. arm an interrupt for in coming notes

I used the same code for creating the note in the second program, but the note does not seem to get created. When I have the debug turned on I get the output showing the note request, but the note is not in notehub. If I then run the single program to create a note, that program creates a note and the other note previously created show up.

The function I use and the json output from the debug are below. Any suggestions as to where I should look? I have not been successful in tracing this down.

randy

J *req = notecard.newRequest(“note.add”);
if (req != NULL){
JAddStringToObject(req, “file”, “twilio.qo”);
JAddBoolToObject(req, “sync”, true);
J *body = JAddObjectToObject(req, “body”);
if (body)
{
JAddStringToObject(body, “body”, subject);
JAddStringToObject(body, “from”, “+19999999999”);
JAddStringToObject(body, “to”, “+19999999999”);
}
notecard.sendRequest(req);
}

---------output on function when note is not created in notehub--------------

{“req”:“note.add”,“file”:“twilio.qo”,“sync”:true,“body”:{“body”:“The current temperature is:25.2”,“from”:“+19999999999”,“to”:“+19999999999”},“crc”:“0005:41BB3EC3”}
{“total”:1}

Hi @rksteeves,

The fact that you get a {"total":1} response from the Notecard is good and it means the Note was successfully saved to flash and it’s ready to sync. You may have a connectivity issue if that total increases with each subsequent note.add request. You can issue a card.wireless request to see the status of the wireless connection, but see that link above for more help with diagnosing a possible connectivity issue.

Rob

Your answer sounds logical, but the fact that I have another program that will create a note (the same note) and post it to notehub each and every time leads me to believe that it is something else. And if there is a backlog of these notes, they get posted as well with the crate note program that works fine.

I will have a look at the connectivity issue link above, but I am thinking it is something else. If you have any other thoughts, please let me know

So I have continued to dig…

I put a couple of calls to the sendSMS function in the setup function and they all work fine. The failure happens as soon as a note interrupt happens. !attnInterruptOccurred
I tried to send an sms right after an this is where it fails every time. The debug output shows the message being created, but it is not posted to the notehub.

Does this help? The sms function is essentially what I initially posted for creating a sms note.

void loop(){

// If the interrupt hasn't occurred, exit and continue loop
if (!attnInterruptOccurred){
    return;
}

Serial.println("interupted");
sendSMS("got a note interupt");
getmessage();   //get the message 
attnArm();      //rearm interupt

}

Can you send me the full sketch in a PM? This is difficult to debug without the full context of the problem.

I sent the sketch to you in an email

Wanted to wrap up this thread. It turned out the problem was a bug in the Notecard firmware preventing immediate sync w/ note.add/sync:true when issuing a note.get request immediately preceding or following the note.add request. This will be fixed in the upcoming v5.3.1 developer firmware release.

I see that there is a new release as at Sept 18… v5.3.1

Can you confirm that the fix for the above issue has been resolved in the release as it is not specifically called out in the notes

thanks

Yes it’s in there! We don’t always include every single bug fixed in the release notes (those are just the greatest hits :slight_smile:).

Rob