Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
Jan Chrillesen
@janchrillesen
larsenglund: If you just need to transmit you can use GPIO 2 for TX. Search for Serial1 on https://github.com/adafruit/ESP8266-Arduino
Lars Englund
@larsenglund
@janchrillesen All other pins are taken in my design :) But I just tried using gpio3 after running Serial.begin and it seems to be working just fine!
Jan Chrillesen
@janchrillesen
larsenglund: OK - for for applications where you need the UART on GPIO1/3 and also needs serial debug using Serial1 is a good solution
torntrousers
@torntrousers
Hi. How hard would it be to update a local build of the trunk code to use the latest sdk, 1.5.3? Could i just do something like overlay the 1.5.3 zip over the trunk checkout somewhere or is it more complicated that that?
Me No Dev
@me-no-dev
no, it's a bit more complicated than that
torntrousers
@torntrousers
any hints or pointers?
Me No Dev
@me-no-dev
you need to replace li libs, weaken libmain for umm_malloc to work and update the relevant headers in the SDK folder of the core with whatever they have added between 1.5.2 and 1.5.3
you can not replace the headers in the SDK folder, just add what's new to them
torntrousers
@torntrousers
mmm, ok, thanks. sounds a bit hard
Michael Miller
@Makuna
@larsenglund Yes it does work, just make sure to init the pin after the Serial.begin() and it will override the pin feature.
geman220
@geman220
@skorokithakis you happen to be around?
geman220
@geman220
Or if anyone can help me, when I try to upload my code I get the following:
warning: espcomm_send_command: wrong direction/command: 0x03 0x03, expected 0x01 0x03
warning: espcomm_send_command(FLASH_DOWNLOAD_DATA) failed
error: espcomm_upload_mem failed
Baruch Even
@baruch
@igrr, I would like to hear your thoughts on the change I'm proposing to the delay function to simplify integration of coroutines usage.
I'm trying to use the coroutine code that is already written for my system by creating a cooperative threading mini-system to simplify my code. For that it would be extra nice to be able to override the delay function when running inside a coroutine from the normal delay to the coroutine switching out. For this I need to make the delay function a weak symbol. Will such a change be acceptable for the project?
Obviously, I'd be happy to contribute the cooperative threading as well
Michael Miller
@Makuna
@geman220 I get this same thing once in a while, did you just try again?
geman220
@geman220
Now I'm getting an error when building. error: redefinition of 'void setup()'
Michael Miller
@Makuna
@baruch overriding what delay does can be tricky. Some libraries are very time sensitive and any extra time from a call to delay due to coop task taking to long could break it. I "preach" to not use delay at all in the sketch with my task library due to this.
geman220
@geman220
Should the serial monitor work in the Arduino IDE with the esp?
It joined my wireless network because I can ping it but serial montior has no output and it should be printing out that it's connected
I'm using a Wemos if that makes a difference
Michael Miller
@Makuna
@geman220 yes it works. It works with my wemos. Are you sure you don't have a bad board?
geman220
@geman220
Well my code uploaded and it's on my wifi
bobcroft
@bobcroft
@geman220 Yes, the output of Serial.print (...........) should be visible on the Arduino serial monitor and any other serial connected device like for instance 'Coolterm'. The error message you got means that the Arduino IDE with, esp8266 Arduino installed, cannot sync to the ESP8266 module. This can be due to the ESP not being in the correct mode for flash programming or the TX Rx incorrectly connected. Another issue if the WEMOS is like the nodeMCU is to make sure you select the correct board in the Arduino tools menu. If you have selcted generic 8266 then it will not flash a nodeMCU type board correctly. Also if trying to download using the nodeMCU format you need to have CTS and RTS lines correctly connected to GPIO 0 and reset on the ESP8266 module. There are loads of posts about these connections via a bit of Google searching.
geman220
@geman220
Sorry I should clarify. That error message went away by itself, no idea why. I can upload code to my ESP just fine. It is on my WPA network so it's running the code to connect, I just don't see anything in serial monitor
Michael Miller
@Makuna
@geman220 did you make sure the baud rate are set the same in the sketch and the monitor?
geman220
@geman220
void connectWifi() {
    if (WiFi.waitForConnectResult() != WL_CONNECTED) {
        resetPins();
        WiFi.mode(WIFI_STA);
        while (WiFi.waitForConnectResult() != WL_CONNECTED) {
            WiFi.begin(WIFI_SSID, WIFI_PASS);
            Serial.println("Connecting to wifi...");
        }

        Serial.print("Wifi connected, IP address: ");
        Serial.println(WiFi.localIP());
    }
}
I didn't set a baud in the sketch
That works and it connects because I can ping. If I disconnect my ESP I can't ping. So I'm pinging the correct device
Michael Miller
@Makuna
In your sketch, did you call Serail.begin ()? If you don't Serail doesn't work at all. This call also takes the baud rate as a param, which needs to match the one in the monitor.
geman220
@geman220
And this is a really dumb question but I'm new to Arduino. Pin: D1 Function: IO, SCL ESP8266 Pin: GPIO5`` When I define to use a pin for examplemyservo.attach(?)``` I would replace '?' with '5' correct?
No I didn't know I had to do that =(
Michael Miller
@Makuna
For pins often you can use "D1", or just the number when it's gpio.
geman220
@geman220
Okay, thanks!
Baruch Even
@baruch
@Makuna, When and if I have a really strict time requirements I concur with your idea, but for most times I don't care that much about time and the coding simplicity of not using a state machine as I need to do now will be a godsend.
Most of my work so far was in reading i2c sensors, and these take time to provide the data (anywhere from 10ms to 100msec), there is no point to hold off other processes and since I need to read several sensors (temp & humidity or several adc lines) there is a state I need to keep and switch based on. This makes the code far more complex compared to a coroutine.
There is indeed an extra cost of stack switching for the coroutine but I'm willing to pay for that. If my approach is accepted the normal user will have no cost whatsoever as he will not override the delay function, but for me I can use any library even if it calls delay inside my coroutine as I will replace the delay and check if it is in a coroutine now and use my coroutine delay which will switch away and return when the time has come to continue.
Michael Miller
@Makuna
@baruch yes, with the esp this less an issue, my task was written for avr, much less memory. My point was that you don't know what library are doing, and changing the fundamental way an Arduino Api is expected to work can cause unforseen and hard to track issues.
consider exposing another function like CoDelay ().
geman220
@geman220
Serial.begin(115200); I changed my monitor to 115200 still not seeing anything for some reason
Michael Miller
@Makuna
@geman220 backup, try a simple example with Serail output and see if it works.
geman220
@geman220
Okay, one second
Michael Miller
@Makuna
@baruch but as you said, it won't effect others who are using your replacement.
Baruch Even
@baruch
@Makuna but then I need to modify every library I use, I can do that and will if the weak symbol is not acceptable, it's just a bit more tedious and requires a review of each library I integrate. I'm not espousing making everyone use such a threading library as it requires some care, but given the right care it makes other code simpler and easier to follow. Which means I can care once for the hard part of the threading and coroutine and later on enjoy easier development.
I'm too lazy to work hard to code a state machine for each sensor I want to monitor :-)
I'm also used to using coroutines elsewhere and find them very appealing
geman220
@geman220
If anyone can point me in the direction of what I'm doing wrong I'd be very appreciative. My ultimate goal is to have my Wemos subscribe to a topic and turn a servo based on a message published to that topic. My Wemos is connecting to my WiFi and it is connecting to the MQTT broker. I have a topic /log and /status and when I send a message to the command topic the Wemos is responding correctly in the log topic with "Command [command] received". In my status topic the Wemos is reporting "Connected" once it's rebooted. The problem I'm obviously having is making the Wemos turn the servo when a specific command is received. I'm new to this and I thought what I had would work, but obviously it's not. Also for some reason my Serial monitor refuses to work. If anyone can take a look at my code it would be a massive help, thanks. https://www.pastery.net/hxerce/
Michael Miller
@Makuna
@geman220 servo is on pin 1, comment states pin 5. You reset the pin after calling servo.attach, don't do that.
geman220
@geman220
Yea sorry I didn't change my comment the problem was I needed to specify 'D1' not 1
Works now
Ivan Grokhotkov
@igrr
@baruch yes, making delay a weak function is totally okay.