#2 NodeMCU/ ESp8266 Tutorial: GPIO (Digital Input and Output)

Поділитися
Вставка
  • Опубліковано 21 лис 2018
  • In this video we have had look at how to use the pin as input and output. We have talked about two different pinMappings and GOIO trap to avoid when designing your own device with esp-12e module and the internal pull up resistors.
    We have measured the GPIO speed and finally we have seen the IO rating and made a LED circuit with current limiting resistor.
    The diagram of ESP-12E module is taken from: www.esp8266.co...
  • Наука та технологія

КОМЕНТАРІ • 9

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

    You have explained very well and all my queries has be resolved as I'm tired of search the idea to install a regular wall switch with relay in my home automation project thankyou

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

    thanks bro..

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

    Well Done....

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

    I used a esp8266 together with a Touch Module (TTP223). In the code i put GPIO 2 to be INPUT (to read the signal from TTP223) but when I press the TTP223, the ESP8266-01 can not control the Relay.

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

      It is hard to solve your problem without looking at the hardware setup and the software.

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

      This is my Diagram, sorry for ugly draw :)
      media9.hopto.org:81/GPIO/IMG_2487.JPG

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

      And this is ESP 8266-01 Module: github.com/IOT-MCU/ESP-01S-Relay-v4.0/blob/e102ac8e912e186e81b031334f095fb14c6abab7/ESP-01S%20Relay%20v4.0.pdf

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

      and here is the code:
      //------------------------------------------------------------------------
      // Assign output variables to GPIO pins
      const int touchPin = 2; //connect output from the Touch Module TTP223 to this pin on ESP8266
      const int output0 = 0; //ĐÈN 2 Chân GPIO 0 ket noi voi Relay
      int val = 0;
      void setup() {
      Serial.begin(115200);
      // Initialize the output variables as outputs
      pinMode(touchPin, INPUT);
      pinMode(output0, OUTPUT);
      // Set outputs to
      digitalWrite(output0, LOW);
      //--------------------------------------------------------
      and more code:
      //------------------------------------------------------------------------
      // turns the GPIOs on and off
      if (header.indexOf("GET /0/on") >= 0) {
      Serial.println("GPIO 0 on");
      output0State = "ON";
      den2state = "BẬT";
      digitalWrite(output0, LOW);
      val = digitalRead(touchPin); //Read value from the TTP223 Touch
      if(val ==1){
      Serial.println("Touched");
      digitalWrite(output0, HIGH);
      }
      } else if (header.indexOf("GET /0/off") >= 0) {
      Serial.println("GPIO 0 off");
      output0State = "OFF";
      den2state = "TẮT";
      digitalWrite(output0, HIGH);
      val = digitalRead(touchPin); //Read value from the TTP223 Touch
      if(val ==1){
      Serial.println("Touched");
      digitalWrite(output0, LOW);
      }
      }
      //------------------------------------------------------------------------

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

      Can you working on it? Mohammed?