These are chat archives for esp8266/Arduino

20th
Jan 2016
Christian St. Cyr
@cstcyr
Jan 20 2016 02:22
I had a question about how picking a board in the IDE effect pin mapping.
I'm using a devkit 1.0 and the external pins have their own names D1,D2 etc
So when i2c notes say use 4 and 5 I connected to D4 and D5
Then I realized that meant GPIO 4 and 5.
Should selecting a particular board in the tools menu change what "4" and "5" map to.
I imaging this something you guys had to think about so just throwing it out there. Thanks for the great work on the package was able to get something up and running very quickly.
Chris Elsworth
@celsworth
Jan 20 2016 02:52
yes, it does
the board you select in the menu affects which .h gets included, so the D4 define (and others) change
Aditya Tannu
@AdySan
Jan 20 2016 05:17
Asking for a friend 😀 : Out of these, what would the closest architecture in terms of processing power to the ESP8266?
Cortex-M0, Cortex-M3, Cortex-M4F, microAptiv UP
Michael Miller
@Makuna
Jan 20 2016 08:51
@adysan @probonopd have you examined my NeoPixel library? I have a branch that works with uart, and another with i2s, both work well with wifi? I accept others work (i2s was from another person). NeoPixelBus is the project. While based on adafruit work, I seperated color objects and animations support out of the base support. If you have questiins, I also have a Gitter channel for discussion for that work.
Aditya Tannu
@AdySan
Jan 20 2016 14:20
@Makuna @probonopd I have tried your library, all branches actually, I couldn't get it to work. All I could see was extremely random colors flashing all over the strip. I assumed it to be some electrical issue with GPIO vs hardware driven UART. I don't use any level converters for the data pin.
@Makuna I've noticed none of these libraries explicitly mentions 'use pin D9,RXD0' etc. would be a really helpful hint for newbies! It's obvious to most but not everyone.
Markus
@Links2004
Jan 20 2016 16:24
@AdySan the "cpu" core inside the ESP is a lx106 from xtensa
Aditya Tannu
@AdySan
Jan 20 2016 16:48
@Links2004 Thanks, someone is interested in porting something like this stack to the ESP8266, want to try and evaluate whether it is worth trying even. http://oberonhap.com/
Chris Elsworth
@celsworth
Jan 20 2016 16:51
RAM looks to be the issue to me
they claim 14k - 20k of ram usage
Markus
@Links2004
Jan 20 2016 16:52
the ESP runs on 80Mhz with 32bit, it is better then any M0+ for sure, same performance then on a Cortex-M3 is possible.
left ~10k for other stuff with 10k you can do many thinks its 10 times a arduino uno :)
the biggest problem is the stack you link is for BLE (Bluetooth)
Me No Dev
@me-no-dev
Jan 20 2016 16:54
maybe on esp32 ;)
Chris Elsworth
@celsworth
Jan 20 2016 16:55
either need a 32 or an external module then
Stavros Korokithakis
@skorokithakis
Jan 20 2016 17:05
@tzapu those pcbs look great! i made them small so the antenna should mostly stick out
@tzapu dirtypcbs took two weeks to arrive for me, $14 for 40 boards
4 per panel
Chris Elsworth
@celsworth
Jan 20 2016 17:08
good value :)
that'll keep you going a while
Stavros Korokithakis
@skorokithakis
Jan 20 2016 17:10
yeah :/ the problem is i'm already up to version 1.3
Aditya Tannu
@AdySan
Jan 20 2016 17:10
@Links2004 @celsworth nah the intent here is Wifi,
Stavros Korokithakis
@skorokithakis
Jan 20 2016 17:10
which has a dedicated vcc pin
but eh, who cares, it just mostly looks better
Aditya Tannu
@AdySan
Jan 20 2016 17:10
The protocol stack may be a BLE stack, or an IP stack for WiFi or Ethernet accessories
Me No Dev
@me-no-dev
Jan 20 2016 17:15
hey guys, who got arducam working here?
Stavros Korokithakis
@skorokithakis
Jan 20 2016 17:16
hmm
one of these dudes
Aditya Tannu
@AdySan
Jan 20 2016 17:16
@me-no-dev @mozgy
Stavros Korokithakis
@skorokithakis
Jan 20 2016 17:16
but i don't remember who
ah
Me No Dev
@me-no-dev
Jan 20 2016 17:16
@AdySan thanks
@mozgy ping!
Aditya Tannu
@AdySan
Jan 20 2016 17:22
Speaking of ArduCAM, this MLX90621 IR array, is kinda cool too https://github.com/longjos/MLX90621_Arduino_Camera
Mario Mikočević
@mozgy
Jan 20 2016 18:04
just got home, patience
I have ArduCAM working
@me-no-dev how can I help ?
Me No Dev
@me-no-dev
Jan 20 2016 18:06
I have one and would like to test a theory
that I'm not even sure it can be done
maybe chat private so we do no clog the room?
Mario Mikočević
@mozgy
Jan 20 2016 18:07
ok
Aditya Tannu
@AdySan
Jan 20 2016 18:20
I'd love to hear!
Mario Mikočević
@mozgy
Jan 20 2016 18:21
Need To Know ! :p :D
beikeland
@beikeland
Jan 20 2016 18:23
Sure maybe OT, but peaked my interest - i'd love to lurk in the corner if you take it elsewhere :P
Michael Miller
@Makuna
Jan 20 2016 18:31
@adysan I wish you would take this conversation off this main channel, but with ALL NEOPIXELS you have to either use a level converter or you have to run the esp hot at a minimum 3.8v to get an stable use.
And the DmaDriven branch (I2s) is new. But I have had no issues with UartDriven branch either.
Aditya Tannu
@AdySan
Jan 20 2016 18:44
@Makuna Got it. Thanks for the pointers.
ZaPpInG
@lrmoreno007
Jan 20 2016 18:55
I'm trying the OTA Sync proposed by Wemos in issue #1056 and merged, and it's awesome. Thanks!!.
ZaPpInG
@lrmoreno007
Jan 20 2016 19:20
I'm having many problems of interferences when i put my esp8266 project in the cabinet of a punch machine. I've many restart of the esp8266. Somebody know how to solve this interferences? When I use it in my home it run OK.
d-anders
@d-anders
Jan 20 2016 19:59
power supply?
Helio Machado
@crushedice2000
Jan 20 2016 21:10
Hi! I have this code:
  for (JsonObject::iterator root=json.begin(); root!=json.end(); ++root) {
    if ((const char*)root->key == "network") {
      Serial.println("Case network");
    } else if ((const char*)root->key == "hardware") {
      Serial.println("Case hardware");
    } else if ((const char*)root->key == "properties") {
      Serial.println("Case properties");
    } else {
      Serial.println("Case default");
      Serial.println(root->key);
    }
}
Why it only triggers the else?
Busy now, I'll be here again in 30 min
Anwar Hahj Jefferson-George
@anwarhahjjeffersongeorge
Jan 20 2016 21:18
@crushedice2000 What does the Serial.println(root->key) output? If it only triggers the else, isn't cos the other statements didn't match?
Anwar Hahj Jefferson-George
@anwarhahjjeffersongeorge
Jan 20 2016 21:27
@lrmoreno007 is the cabinet metal?
Martin Ayotte
@martinayotte
Jan 20 2016 21:32
@crushedice2000 , I don't know the ArduinoJson lib yet, but comparing strings in C/C++ is not done like that because you only compare pointer numeric values. It should be done with something like : if (strcmp(root->key, "network") == 0) {
Or if root-key is a String object : if (root->key.equals("network")) {
Johan Euphrosine
@proppy
Jan 20 2016 21:33
I think Arduino Strings do override ==
(as in Arduino String object not C string (char *))
Martin Ayotte
@martinayotte
Jan 20 2016 21:36
Yes, but it wasn't the case in the above code. I'm now installing ArduinoJson to take a look what root->key is ...
Johan Euphrosine
@proppy
Jan 20 2016 21:36
@martinayotte oh yes, sorry I didn't took a close you at the context :)
Martin Ayotte
@martinayotte
Jan 20 2016 21:42
Looking at ArduinoJson, it is retuning a hash, such as JsonObject& root = jsonBuffer.createObject(); , so, I don't even understand the context of @crushedice2000 code.
Anwar Hahj Jefferson-George
@anwarhahjjeffersongeorge
Jan 20 2016 21:47
It seems I used to be able to add a printf() call in a core library to test output. Does this not work anymore?
Markus
@Links2004
Jan 20 2016 21:48
you need to init the Serial and run setDebugOutput the you can us os_printf
or simple use Serial.printf
Helio Machado
@crushedice2000
Jan 20 2016 21:49
@martinayotte: Thanks! strcmp works!
Markus
@Links2004
Jan 20 2016 21:49
@crushedice2000

  for (JsonObject::iterator root=json.begin(); root!=json.end(); ++root) {
    String key = (const char*)root->key;
    if (key== "network") {
      Serial.println("Case network");
    } else if ((key== "hardware") {
      Serial.println("Case hardware");
    } else if (key == "properties") {
      Serial.println("Case properties");
    } else {
      Serial.println("Case default");
      Serial.println(key);
    }
}
too late ;)
Martin Ayotte
@martinayotte
Jan 20 2016 21:50
:-)
Mario Mikočević
@mozgy
Jan 20 2016 21:50
might help
Helio Machado
@crushedice2000
Jan 20 2016 21:50
@Links2004: I'm sorry, however, I thank you very much for your effort!
@mozgy: Looking...
Aditya Tannu
@AdySan
Jan 20 2016 21:52
@mozgy so that logs all wifi networks it comes across to the SPIFFS
Mario Mikočević
@mozgy
Jan 20 2016 21:52
yep
Markus
@Links2004
Jan 20 2016 21:52
@crushedice2000 no problem, have read you massage 1 min ago and take a look in my code, as long it work for you the chat has done its jop.
Mario Mikočević
@mozgy
Jan 20 2016 21:54
@AdySan not exactly all 'cos it's periodically scans, not all the time
Aditya Tannu
@AdySan
Jan 20 2016 21:55
@mozgy purpose? Could be used as a free- wifi scanner, if it finds one, will try to connect to internet and send a push notification maybe
Helio Machado
@crushedice2000
Jan 20 2016 21:56
for (JsonObject::iterator root=json.begin(); root!=json.end(); ++root) {
    if (strcmp(root->key, "network")) {
      Serial.println("Case network");
      Serial.println(root->key);
    } else if (strcmp(root->key, "hardware")) {
      Serial.println("Case hardware");
      Serial.println(root->key);
    } else if (strcmp(root->key, "properties")) {
      Serial.println("Case properties");
      Serial.println(root->key);
    } else {
      Serial.println("Case default");
      Serial.println(root->key);
    }
  }
Why is this matching wrong?
Mario Mikočević
@mozgy
Jan 20 2016 21:56
it's was basically test for json and SPIFFS, to see how can it be done
Helio Machado
@crushedice2000
Jan 20 2016 21:57
Trying Markus solution...
Anwar Hahj Jefferson-George
@anwarhahjjeffersongeorge
Jan 20 2016 22:03
@Links2004 yeah, thanks, the problem seems to have been because I called setDebugOutput() before begin() for Serial
Chris Elsworth
@celsworth
Jan 20 2016 22:15
@crushedice2000 strcmp returns 0 on a match
Helio Machado
@crushedice2000
Jan 20 2016 22:15
Anybody knows how to convert a JsonObjectKey into char*?
@celsworth: What means that? Isn't the expected behavior?
Also, what means this on the public section of a class? operator const char*() const { return _data;
Mario Mikočević
@mozgy
Jan 20 2016 22:17
from https://github.com/bblanchon/ArduinoJson/wiki/Examples
char json[] = "{\"key\":\"value\"}";
JsonObject& object = jsonBuffer.parseObject(json);

for(JsonObject::iterator it=object.begin(); it!=object.end(); ++it) 
{
    // *it contains the key/value pair
    const char* key = it->key;

    // it->value contains the JsonVariant which can be casted as usual
    const char* value = it->value;

    // this also works
    value = it->value.as<const char*>();

}
Chris Elsworth
@celsworth
Jan 20 2016 22:17
so you need if (strcmp(root->key, "network") == 0)
Helio Machado
@crushedice2000
Jan 20 2016 22:21
@mozgy @celsworth: I'm switching to C++11 loop iterator for (auto root : json) {
Chris Elsworth
@celsworth
Jan 20 2016 22:21
I don't know that syntax.. my C++ isn't so great :)
Helio Machado
@crushedice2000
Jan 20 2016 22:22
@celsworth The only question is what means this: operator const char*() const { return _data;
Chris Elsworth
@celsworth
Jan 20 2016 22:25
I think its to allow implicit conversion to a char *
so if you try to refer to that class somewhere a char * is expected, it will just work automatically
Helio Machado
@crushedice2000
Jan 20 2016 22:28
@celsworth: Thanks! trying...
@mozgy @celsworth @Links2004 @martinayotte: Final got working. Thanks you!
  for (auto root : json) {
    if (strcmp(root.key, "network") == 0) {
      Serial.println("Case network");
    } else if (strcmp(root.key, "hardware") == 0) {
      Serial.println("Case hardware");
    } else if (strcmp(root.key, "properties") == 0) {
      Serial.println("Case properties");
    } else {
      Serial.println("Case default");
      Serial.println(root.key);
    }
  }
Chris Elsworth
@celsworth
Jan 20 2016 22:32
great :)
looks good :)
Mario Mikočević
@mozgy
Jan 20 2016 22:36
hehehheh, your code only needed '!' sign
->
  DynamicJsonBuffer jsonBuffer;

  JsonObject& test = jsonBuffer.createObject();
  test["network"] = "net";
  test["hardware"] = "hw";

  for ( JsonObject::iterator root = test.begin(); root != test.end(); ++root ) {
    if (!strcmp(root->key, "network") ) {
      Serial.println("Case network");
      Serial.println(root->key);
    } else if (!strcmp(root->key, "hardware") ) {
      Serial.println("Case hardware");
      Serial.println(root->key);
    } else if (!strcmp(root->key, "properties") ) {
      Serial.println("Case properties");
      Serial.println(root->key);
    } else {
      Serial.println("Case default");
      Serial.println(root->key);
    }
  }

  test.prettyPrintTo( Serial );
  Serial.println();
just tested
Chris Elsworth
@celsworth
Jan 20 2016 22:37
I prefer that new iterator
much cleaner
and == 0 or ! is pretty much personal preference. I think == 0 is more explicit
Helio Machado
@crushedice2000
Jan 20 2016 22:37
@mozgy: Looks great, thank you! However I'll use the new iterator.
Tired now, good night.
@mozgy: nn :smiley_cat:
Mario Mikočević
@mozgy
Jan 20 2016 22:39
nn
IDE won't compile that new iterator
Helio Machado
@crushedice2000
Jan 20 2016 22:43
@mozgy: PlatformIO does. I won't use IDE anymore
In fact Arduino IDE for IoT isn't a good choice, because its acronym is IDIoT
Anwar Hahj Jefferson-George
@anwarhahjjeffersongeorge
Jan 20 2016 22:45
@crushdice2000 haha
Sven Eliasson
@comino
Jan 20 2016 23:10
@crushedice2000 so true :D
Stavros Korokithakis
@skorokithakis
Jan 20 2016 23:11
hey guys, does anyone know what the default serial port device is on a mac?
Me No Dev
@me-no-dev
Jan 20 2016 23:34
no such thing as default serial port