Sketch too big

General support questions and discussions.

Re: Sketch too big

Postby tiga31328 » Sat Jan 24, 2015 7:17 pm

I completed a test with the Sketch located at: http://arduino.cc/en/Tutorial/WebClient

Uusing this Sketch, it is able to go out to the Internet, it is able to send a Query to Google for a search term and the contents of that search are sent back and sent out to the Serial monitor for me to view.

With that success, I modified the Sketch to attempt a Prowl notification, doing so worked multiple times, see example below;

connecting...
connected
HTTP/1.1 200 OK
Date: Sat, 24 Jan 2015 23:00:46 GMT
Server: Apache/2.2.3 (CentOS)
Vary: Accept-Encoding
Content-Length: 118
Connection: close
Content-Type: text/xml

<?xml version="1.0" encoding="UTF-8"?>
<prowl>
<success code="200" remaining="999" resetdate="1422144046" />
</prowl>

disconnecting.


The Arduino is capable or retrieving DHCP from my router, and it is able to both get to the Internet on and receive data back from a request.


I went back and started the door opener Sketch from the beginning, using the debug mode and viewing the serial port, I see the following below, but it still does not appear to actually send the Prowl notification:

*** ope*** open notification handler - detected an opened device/door @ pin #4 ***
*** open notification handler - sending notification ***
*** Push - server name: 'http://209.20.72.170' - apiKey: 'xxxx84ce805d7fxxxxf86edf29c12f1cf10cxxxx' - subject: 'MyDoorOpener Notification' - body: 'A door or device has just been opened.' ***
*** Push - completed ***
*** open notification handler - detected an opened device/door @ pin #4 ***
*** open notification handler - NOT sending notification ***
*** open notification handler - detected an opened device/door @ pin #4 ***
*** open notification handler - NOT sending notification ***
*** open notification handler - detected an opened device/door @ pin #4 ***
*** open notification handler - NOT sending notification ***



What can I do/check next?


Thank you,
Patrick
tiga31328
 
Posts: 17
Joined: Mon Dec 15, 2014 11:16 pm

Re: Sketch too big

Postby support » Sun Jan 25, 2015 10:30 pm

Patrick,

From your serial debugging logs, it looks like the line that's failing is the following (near ~254):

Code: Select all
  if (pushClient.connect(prowlServerName, prowlServerPort))


Your logging goes from ...
*** Push - server name: ....... ***

to ...
*** Push - completed ***


And is missing all of the logging that goes in between, whenever the client connection can be established with the Prowl server, such as:
*** Push - connection established ***


Could it be a firewall issue? You might want to play around with that line and try different things, but I don't know what to suggest ... When
you say you were able to perform a Prowl connection from another independent sketch, what "connect" syntax did you use? You might want
to try that syntax here and see if that works ...

Keep us updated on your results and keep persevering, you'll get to the bottom of this ...
support
Site Admin
 
Posts: 384
Joined: Thu Aug 22, 2013 7:30 pm

Re: Sketch too big

Postby tiga31328 » Mon Jan 26, 2015 3:01 am

Thank you for your feedback!

I checked my firewall again, and I even opened it up with a DMZ to the Arduino with no changes.

Two 'odd' things that I have discovered, if I set the IP for the prowlapp server to a computer on my internal network, and I open it up to receive incoming http messages with WireShark running, I do not see any traffic from the Arduino actually hit the computer that is tracing the traffic, as if it is not actually sending anything for the notification at all. I have also found that I can put a totally incorrect IP address for the prowlapp server and the debug will show connection and completed even though the address is not valid and there is no way that it could reach it. It is as if the Sketch attempts to send the notification whether it is really getting outside to the Internet, or not.

The code from the test Sketch that I used that works for the notifications I modified a single line for the GET statement;

if (client.connect(server, 80)) {
Serial.println("connected");
// Make a HTTP request:
client.println("GET http://www.prowlapp.com/publicapi/add?a ... riority=-1 HTTP/1.1");


I have tried substituting the client.connect for your sketch's pushclient.connect, the debug shows that the push is successful but I don't think it is actually sending it, otherwise you would think I would get the Prowl notification and I do not. The Debug from this last test is below;

*** Push - server name: 'http://www.prowlapp.com' - apiKey: '897884ce805d7f9773f86edf29c12f1cf10c4cc8' - subject: 'MyDoorOpener Notification' - body: 'A door or device has just been opened.' ***
*** Push - connection established ***
*** Push - connection stopped ***
*** Push - completed ***


I 'think' the root of my issue is that the notifications aren't really trying to get out.


Patrick
tiga31328
 
Posts: 17
Joined: Mon Dec 15, 2014 11:16 pm

Re: Sketch too big

Postby support » Mon Jan 26, 2015 8:48 pm

Maybe try "hard coding" the parameters to pushClient.connect() instead of using the prowlServerName and prowlServerPort parameters. Sometimes,
in C++ there can be memory corruption and it could be that one of these 2 variable's content gets screwed up. That would end up in some weird issue
such as you're experiencing, although it's strange that you're the only one seeing this ...

By the way, what are your relayPins[] and statusPins[] arrays initialized with ? If you're only using/connecting a single sensor/relay, remove the other
pin value entry from the initialization block for these arrays.
support
Site Admin
 
Posts: 384
Joined: Thu Aug 22, 2013 7:30 pm

Previous

Return to Support



cron