Use TX and RX as GPIO on your ESP8266

Поділитися
Вставка

КОМЕНТАРІ • 45

  • @MPElectronique
    @MPElectronique 5 років тому +11

    // this will swap the pin to a GPIO
    pinMode(1, FUNCTION3);
    // this will restore the pin to Tx
    pinMode(1, FUNCTION0);

    • @onuralptop18
      @onuralptop18 3 роки тому

      can i program esp without tx pin ?

    • @MPElectronique
      @MPElectronique 3 роки тому +1

      @@onuralptop18 no i dont think so.

    • @naingtheawperc3817
      @naingtheawperc3817 3 роки тому

      Which one of RX and TX is better to be used as Input?

  • @ahmedal-musharraf9242
    @ahmedal-musharraf9242 5 років тому +7

    TX & RX pins: **exists**
    Brian Lough: it's free real estate!

    • @BrianLough
      @BrianLough  5 років тому +1

      This is one of my favourite comments ever 😂

  • @bornach
    @bornach 5 років тому +8

    Ooh. Thanks for the mention!
    I found out about remapping tx/rx while researching the ESP8266 I2C stuff also.
    I want my .... serial monitor!

    • @BrianLough
      @BrianLough  5 років тому +1

      Some people just want the world 😂

    • @tablatronix
      @tablatronix 5 років тому

      bornach, Can you provide more information about this, I do not think this does anything, pinmode output should work fine, also if you have init serial you will want to Serial.end() to deinit it then pinmode to output

    • @bornach
      @bornach 5 років тому

      @@tablatronix Here's what I found on tx rx remapping as GPIO
      arduino.stackexchange.com/questions/29938/how-to-i-make-the-tx-and-rx-pins-on-an-esp-8266-01-into-gpio-pins

  • @bgable7707
    @bgable7707 Рік тому

    You got to love those pointer deferences:
    To change the address it points to:
    struct_inst->pointer = &var;
    To change the value at the address to which it points:
    *(struct_inst->pointer) = var;

  • @Chickey
    @Chickey 5 років тому +1

    Your putting us to shame doing a video at 6am!! Great video as always.

    • @BrianLough
      @BrianLough  5 років тому

      Cheers Colin!
      I actually started before 6 but I had a few takes I had to throw away, probably because it was 6 in the morning 😂

  • @MaxintRD
    @MaxintRD 5 років тому +1

    Hi Brian, I showed in one of my videos how I used them for I2C to drive an OLED on the ESP-01, which is even more pin limited. In my current project I'm using the PCA9685 and the PCF8575 to add 16 I/O pins and 16 PWM pins in addition to a TM1637 (for driving LEDs and reading buttons).

  • @roostertechchan
    @roostertechchan 4 роки тому

    Cool! I was trying with the resistors first, but pinMode is the way to go. I got it working with DS3231 and the led matrix ;)

  • @middelbh
    @middelbh 5 років тому

    Brian, I did the same with my ESP32-cam. There is an extra problem as I wanted to use the camera, the SD card, a display and a button, far too little IO’s, so I also needed to use GPIO0 for input. I will put this on UA-cam as soon as the code is cleaned up.

    • @BrianLough
      @BrianLough  5 років тому

      Sounds great Hans! Please share when you do

  • @marcisiosouza
    @marcisiosouza 4 роки тому

    Hey! thank you for explanation. i have a question: RX TX from ESP01, working as GPIO (FUNCTION_3) may be working as external interrupts via attachInterrupt? i try some times and no success. sorry for my bad english, is not my native language.

  • @yawarsaeed6499
    @yawarsaeed6499 Рік тому

    Thanks for sharing the video to use tx Rx pins as gpios.
    I m using 16x2 LCD without i2c with 6 Io pins, sim800l GSM module with 2 io pins tx Rx &
    2 input pins used as trigger .
    LCD display & trigger functions are ok without connecting the sim800l GSM module tx Rx pins connectivity, when these are connected the LCD gets blank. All together I m using 8 gpios & tx & Rx pins total 10 pins.
    I have also checked the serial data communication on Arduino serial terminal by removing tx Rx connections from sim800l.
    Which is working ok without any problem & LCD is also ok.
    Can you please guide as to why the esp8266 starts malfunctioning while connecting tx Rx pins to sim800l mode.
    Awaiting your earliest response.
    Thanks

  • @Magic-Smoke
    @Magic-Smoke 5 років тому

    Cool! I've used this technique but not with the pointer - great idea - especially for 6 in the morning - lol

    • @BrianLough
      @BrianLough  5 років тому +1

      A more alert awake version of me used that technique before when using WifiManager with some of the API libraries so this morning's Brian can't take much credit for it 😂

  • @viniciusnoyoutube
    @viniciusnoyoutube 5 років тому

    Very useful tip.
    Thanks!

  • @nickc2928
    @nickc2928 2 роки тому

    Hi, can you show me a code example of how you made the animation on the display when connected to wifi?

  • @ChrisHalden007
    @ChrisHalden007 3 роки тому

    Excellent. Thank you

  •  5 років тому

    Fiddling with the Rx/Tx lines I found out that some of my USB2UART converters pull both up, others only one. I2C needs pullups on both lines, so no harm done.
    Maybe the way you wired the LEDs is pulling the Rx/Tx lines down, thus interfering with the serial programming.

    • @gavinsmalley1513
      @gavinsmalley1513 5 років тому +1

      Maybe it would program ok if the pins were used to sink the current from the LEDs rather than source it? (Albeit the HIGH/LOW logic is then reversed) If the pins are pulled up then the programmer may run more reliably?

  • @alcanceweb
    @alcanceweb 5 років тому

    That's awesome, thank you.

  • @braysonjohn2924
    @braysonjohn2924 2 роки тому

    I have a NodeMcu 1.0, i think am out of digital input pins for my sensors. I have RFID (5 Digital pins), SIM800L (2 Digital pins), 2 buttons (2 pins), LCD Display (2 pins), 4 LED (4 pins). How can I work with all these with just one nodemcu.

    • @BrianLough
      @BrianLough  2 роки тому

      The LEDs and buttons are probably the easiest to remove. There are i2c pin expanders (pcf8574 for example) that would probably do the job, and assuming your display also uses i2c it means it would use no additional pins and give you back the 6 from the buttons and LED

    • @BrianLough
      @BrianLough  2 роки тому

      The other suggestion would be to move to something with more pins like an esp32

  • @charedok2482
    @charedok2482 5 років тому

    Yes just for drive leds, could it drive relays too?

    • @BrianLough
      @BrianLough  5 років тому +1

      I dont see why not. Maybe for to protect the pin it might be better to use a transistor inbetween, I found I needed to do that with relays a few times on the ESP8266 on regular pins

  • @saberibrahim8263
    @saberibrahim8263 Рік тому

    how to use GPIO3 as input

  • @gavinsmalley1513
    @gavinsmalley1513 5 років тому

    /ponders How many other "FUNCTION_?" modes are they and what do they do? ;-)

    • @BrianLough
      @BrianLough  5 років тому

      Good question! I know there is one to set it back to serial, but I'm still not 100% sure how any of them work..

    • @simuk
      @simuk 5 років тому

      ​@@BrianLough according to the ESP8266 wiki at www.esp8266.com/wiki/doku.php?id=esp8266_gpio_pin_allocations
      Function 0 up to Function 4, and even a 'SPECIAL' too.

  • @MPElectronique
    @MPElectronique 5 років тому

    Great!!!

  • @onuralptop18
    @onuralptop18 3 роки тому

    How can i return tx/rx pins ?

    • @onuralptop18
      @onuralptop18 3 роки тому

      Because i want to do this in my esp 01.

    • @BrianLough
      @BrianLough  3 роки тому +1

      The actual Programming of the esp is a level below the Arduino sketch, so you don't need to do anything to be able program it again. If you don't do the steps described into the video on the new sketch it will be back to normal too
      I'm pretty sure someone mentions in the comments here how to configure it back to uart pins on the fly, but it's not necessary to do unless you need to use those pins for uart in your sketch

  • @bramSDASCL1759
    @bramSDASCL1759 5 років тому

    Jws esp udah pake 😁