Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
Victor Tseng
@Palatis
received data is in data provided by onUpload()
as i search through the lib code, the only place which calls a write() is inside SPIFFSEditor
and the only place where SPIFFSEditor is used is inside example/ESP_AsyncFSBrowser
I guess you copy-pasted the example without modifying it to suite your needs.
probonopd
@probonopd
I copy-pasted the example and now I want to change it so that it does what I need...
Victor Tseng
@Palatis
yup, don't use that SPIFFSEditor, write your own handler.
cuz you want to do different things.
probonopd
@probonopd
ok, thanks
bidyutper
@bidyutper
Want to store temperature sensor data when there is no Mqtt broker means if I turnoff WiFi.Thus store sensor data publish over Mqtt connection whenever it's find WiFi network.
enriquecml
@enriquecml
@bidyutper you can use SPIFF System file or use RTCMemory for save data
paraflou
@paraflou

Hi.

I am using Async client to connect to philips hue bridge in order to send asynchornously PUT json messages to hue bridge so that i can change hue status and color.

Async client connects to hue bridge and after a few seconds it disconnects (onDisconnect is triggered).

What can i do?

Me No Dev
@me-no-dev
PUT means HTTP and HTTP runs single requests: connect, send, read, disconnect. It's not a connection that is open all of the time
paraflou
@paraflou
And how can i then use async client to make put requests in loop? Calling ::connect every time i want to send request is very slow.
paraflou
@paraflou
'''

'''

define BASE_HUE_URL "192.168.100.175"

define BASE_HUE_PORT 80

define PUT_HUE_URL "PUT /api/[hue bridge key]/lights/3/state HTTP/1.1\r\nHost: http://192.168.100.175\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()
{
Serial.begin(115200);
Serial.setDebugOutput(true);

// Connect to WiFi
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println(" ----- WiFi Connected -----");
WiFi.macAddress(mac);
Serial.print("MAC: ");
Serial.print(mac[0], HEX);
Serial.print(":");
Serial.print(mac[1], HEX);
Serial.print(":");
Serial.print(mac[2], HEX);
Serial.print(":");
Serial.print(mac[3], HEX);
Serial.print(":");
Serial.print(mac[4], HEX);
Serial.print(":");
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")) {
      SPISlave.setData(root["command"].asString());


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

});
server.begin();

aClient = new AsyncClient();

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

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

aClient->onData( {
Serial.print("\r\nData: ");
Serial.println(len);
uint8_t d = (uint8_t)data;
for (size_t i = 0; i < len; i++)
Serial.write(d[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)) {

  aClient->write(PUT_HUE_URL);

}
'''

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
@forkineye
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
#define LWIP_NOASSERT
#define IGMP_DEBUG LWIP_DBG_ON
Shelby Merrick
@forkineye
ugh... well, os_printf is working from sketch, but not from within igmp.c
Shelby Merrick
@forkineye
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
@skorokithakis
hello!
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
@everslick
yes inverter
Me No Dev
@me-no-dev
@skorokithakis SBUS is protocol for RC control. Basically inverted serial at 57600. One way ;)
Stavros Korokithakis
@skorokithakis
Ah, I see, thanks @me-no-dev, @everslick
Shelby Merrick
@forkineye
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
@everslick
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
@thehellmaker
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.
nmenoni
@nmenoni
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?
Thanks!
anecdata
@anecdata
@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.
bobcroft
@bobcroft
@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.
nmenoni
@nmenoni
Ok! I will investigate these methods. Thanks!
mega-hz
@mega-hz
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
@Makuna
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
@thomascoope
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?
ient
(excuse autocorrect) *httpClient
enriquecml
@enriquecml
@thehellmaker for test you can search unit test for c++ language
for example cppunit
gtest,CMOCKA for embedded system
Dmitry Munda
@dimkin-eu
Hi!
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
@thomascoope
@dimkin-eu private repo?