Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
Repo info


define BASE_HUE_URL ""

define BASE_HUE_PORT 80

define PUT_HUE_URL "PUT /api/[hue bridge key]/lights/3/state HTTP/1.1\r\nHost:\r\nUser-Agent: ESP8266HTTPClient\r\nContent-Type: application/json\r\nContent-Length: 11/r/n/r/n{\"on\":true}"

static AsyncClient * aClient = NULL;

void setup()

// Connect to WiFi
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
Serial.println(" ----- WiFi Connected -----");
Serial.print("MAC: ");
Serial.print(mac[0], HEX);
Serial.print(mac[1], HEX);
Serial.print(mac[2], HEX);
Serial.print(mac[3], HEX);
Serial.print(mac[4], HEX);
Serial.println(mac[5], HEX);

server.onRequestBody( {

if (request->url() == "/spi") {
  printf("On request body data: %s\n", data);
  DynamicJsonBuffer jsonBuffer;
  JsonObject& root = jsonBuffer.parseObject((const char*)data);
  if (root.success()) {
    if (root.containsKey("command")) {

      digitalWrite(LPC_INT_PIN, 1);
  request->send(200, "text/plain", "end");


aClient = new AsyncClient();

aClient->onDisconnect( {
Serial.println("############ Async Client Disconnect ############");
delete c;

aClient->onConnect( {
Serial.println("Async Client Connected");
}, NULL);

aClient->onData( {
Serial.print("\r\nData: ");
uint8_t d = (uint8_t)data;
for (size_t i = 0; i < len; i++)
}, NULL);

if (!aClient->connect(BASE_HUE_URL, BASE_HUE_PORT)) {
Serial.println("Connect Fail\n");
AsyncClient * client = aClient;
aClient = NULL;
delete client;

void loop()
if ((WiFi.status() == WL_CONNECTED)) {



This message was deleted
Sorry for the mess. Above is a cut from my code. The thing i am trying to do is to send put messages to hue brigde all the time. How can i achieve this?
Shelby Merrick
Trying to enable debugging for IGMP within lwip and having some issues. I have os_printf working and the following defines in lwipopts.h, but not getting anything. Any idea what I'm missing?
#define LWIP_DEBUG
Shelby Merrick
ugh... well, os_printf is working from sketch, but not from within igmp.c
Shelby Merrick
silly me, thought Arduino compiled lwip each time. Ok, compiling it myself now. having issues tracking down where ETS_ASSERT comes from however
Stavros Korokithakis
does anyone know what this circuit is for? is it level-shifting? https://raw.githubusercontent.com/zendes/SBUS/master/SBUS_inverter.jpeg
err, that seems like the wrong photo
ah, maybe it inverts the signal so the serial gets a 1 when tx is 0
Clemens Kirchgatterer
yes inverter
Me No Dev
@skorokithakis SBUS is protocol for RC control. Basically inverted serial at 57600. One way ;)
Stavros Korokithakis
Ah, I see, thanks @me-no-dev, @everslick
Shelby Merrick
Anyone have a clue where r_rand() comes from? I couldn't find a definition for it anywhere, however its called from lwip - esp8266/Arduino#3498
Clemens Kirchgatterer
it is only called, when LWIP_IGMP is defined though. is IGMP support switched on by default?
ah i see, i didn't look at #3498 first, sorry.
Akash Ashok
Hi Guys, Is anyone aware how to write unit tests for Esp8266 arduino code? I looked through ArduinoUnit but it seems to be incompatible with esp8266.
Hi! I have a sensor implemented with an esp8266 that needs to send data every 15 minutes. I plan to implement it by placing a "delay" of 15 minutes inside the code. Can this cause any problems? Is there a better way to do it?
@nmenoni You could use Ticker https://github.com/esp8266/Arduino/tree/master/libraries/Ticker to set up an interrupt. Then your timing won't be dependent on variations in your code execution.
@nmenoni Using a delay is possibly the worst way to implement periodic data sending or taking sensor readings because it blocks other code whilst the delay code is running. As mentioned you could use ticker alternatively Google 'Non blocking delays on Arduino' There are some examples and explanations of the process. you can use the millis() function for example or a Real Time Clock (RTC) to send data at specific times.
Ok! I will investigate these methods. Thanks!
isnT it possible to make a new delay-command in the arduino-ide?
wich replaces the standart delay with a delay using millis?
Michael Miller
BUT, the issue is to allow other things to continue to work while you wait. See ticker above, I also created an Arduino one some time ago (before esp8266) Github/Makuna/Task to wrap up the concept.
While using Delay() is a nice teaching concept, it is a poor design to use for anything other than examples.
Thomas Cooper
Excuse my lack of experience but I appear to be fundamentally missing something ... I have an adafruit feather 8266 which I want to transmit REST API posts from - to my already functioning API (via HTTPS).
With reference to this video:
*with the http client library attached to my sketch, am I then using the standard arduino httpClient commands, or some specific to the ESP8266.
Furthermore, is there a reference documeny explaining what can & cannot be done with the Httpcl command?
(excuse autocorrect) *httpClient
@thehellmaker for test you can search unit test for c++ language
for example cppunit
gtest,CMOCKA for embedded system
Dmitry Munda
not so related question, but - if you need to store arduino project in github, how do you deal with sensitive data, like request URLs/wifi passes etc ?
Thomas Cooper
@dimkin-eu private repo?
Myles Eftos
@dimkin-eu include file that is gitignored.
And them make a note in the repo, and include a sample configuration file
Dmitry Munda
Public repo
Is there possibility to include
Parameters from file?
But how to compile project with right config if there will be sample config? I.e. how to deal with 2 configs then :smile:
Aaron N.
When you commit the config file do it first with a set of samples.
Then add the file to gitignore
thus it will never be overwritten with your real config file
That way it can keep the same name as the real config file, but just be full of sample data when in the repository
Dmitry Munda
cool, thanx. but then real config will be kept only on original computer . and in case of kaboom will be lost ? :)
Clemens Kirchgatterer
@dimkin-eu what's the deal? you just have to get the default config and enter your wifi password and SSID, and you are rolling again.
Dmitry Munda
Please, somebody help me.
I have a client wifi application running in my ESP, I need to know how to save in the eeprom (esp virtual) the IP address of the ex server ( and also save the SSID and password of the wifi network.
Because through a C # application via tcpip, I will send new values of IP, SSID and password to the ESP save and reboot, picking up the new values.