Sming - Open Source framework for high efficiency native ESP8266 development

User avatar
By j0hncc
#15331 Hello sh4d0w,

I didn't have any problems with using interrupt in Sming. I think I am using 1.0.5.
Will this simple code work for you? ( Paste into Basic_Serial e.g.)
Code: Select all#include <user_config.h>
#include <SmingCore/SmingCore.h>

#define INT_PIN 0   // GPIO0

void interruptHandler()
{
   Serial.println("Pin changed");
}

void init()
{
   Serial.begin(SERIAL_BAUD_RATE); // 115200 or 9600 by default
   attachInterrupt( INT_PIN, interruptHandler, CHANGE);
}
User avatar
By anakod
#15355
But how is the best way to import the new sming with mqtt into Eclipse workspace that already has the existing Sming?

Just download latest actual source code. Also you can automatically update it via GIT.

Is anyone able to help with an example of AJAX/JSON creating a dynamic table from an array in the webserver?

If you problem in Sming code I'm ready to answer. If it's a jQuery related, you can find many jQuery manuals and examples on stackoverflow and specialized sites. It's absolutely equal in Sming environment.

Will this simple code work for you? ( Paste into Basic_Serial e.g.)

Thank you for provided example. I have merged it into repo, but much better in real application don't execute additional code in interrupt handler (just get state, set flag and etc.)
User avatar
By tavalin
#15360
Is anyone able to help with an example of AJAX/JSON creating a dynamic table from an array in the webserver?

If you problem in Sming code I'm ready to answer. If it's a jQuery related, you can find many jQuery manuals and examples on stackoverflow and specialized sites. It's absolutely equal in Sming environment.


Hi anakod

I've managed to get the jQuery working using a hard coded array. :)
I'm now having a problem taking this example further using a list that is returned from the Wifi scanning. It may be my lack of understanding of C/C++ but any help is appreciated.

In the listNetworks method I've copied the BssList to a global variable using memcpy but when I try and use the global variable in the onAjax.... method to create the JSON response the module restarts. I assume it's some sort of memory error causing a crash.

Any ideas what I'm doing wrong?