I am writing a program for the Spark Core. It (1) fetches a text file from an URL, (2) extracts parts from every line, and (3) should blink some attached LEDs accordingly. I just started with part 3.
Now every time I add a simple pinMode(D0, OUTPUT); to the code and update the firmware accordingly, it sends the board to SOS panic mode, with eight blinks (#8 Out of heap memory). The actual code does not run.
Why does the addition of pinmode prevents my sketch from running? What can I do to fix it?
UPDATE: Reduced buffer size in Http Client library to 512, now it works. Considering to use REST client lib instead of Http Client.
All references to Http Client Library removed: 76.1% RAM used.
Unfortunately, the project is not very useful without the http part. Any ideas are greatly appreciated.
Try this REST client, I've had good luck with it... also... can you build locally? If so you can revert back to an older version of code that has more available RAM.
Could you should us where you are adding the pinMode() to?
Also, are you using sprintf() anywhere in your code? If so you can reduce flash memory and most likely ram usage as well by doing a little work:
Great help, thank you! I was just about to introduce sprintf, but now I certainly won’t
pinMode is added to the first lines of setup. I could build locally, that is: I never tried and have not found a good HOWTO. RestClient looks promising, I’ll check it out.
Update: I found a 1024 byte buffer allocation in HttpClient.h, changed it to 512 for now. Spark Core is running again! @nmattisson hope this does not break anything