วันพฤหัสบดีที่ 8 กุมภาพันธ์ พ.ศ. 2561

ESP8266 Access point scanner Show LCD








#include <Wire.h>
#include <LiquidCrystal_I2C.h>

// Set the LCD address to 0x27 for a 16 chars and 2 line display
LiquidCrystal_I2C lcd(0x27, 16, 2);




#include "ESP8266WiFi.h"

void setup() {
  Serial.begin(115200);

  // Set WiFi to station mode and disconnect from an AP if it was previously connected
  WiFi.mode(WIFI_STA);
  WiFi.disconnect();
  delay(100);

  Serial.println("Setup done");

  // initialize the LCD
  lcd.begin();
}

void loop() {
  Serial.println("scan start");

  // WiFi.scanNetworks will return the number of networks found
  int n = WiFi.scanNetworks();
  Serial.println("scan done");
  if (n == 0)
    Serial.println("no networks found");
  else
  {
    Serial.print(n);
    Serial.println(" networks found");
    for (int i = 0; i < n; ++i)
    {
      // Print SSID and RSSI for each network found
      Serial.print(i + 1);
      Serial.print(": ");
      Serial.print(WiFi.SSID(i));
      Serial.print(" (");
      Serial.print(WiFi.RSSI(i));
      Serial.print(")");
      Serial.println((WiFi.encryptionType(i) == ENC_TYPE_NONE)?" ":"*");
      delay(1000);

// LCD

      lcd.setCursor(0,0);
      lcd.print(i + 1);
      lcd.setCursor(0,1);
      lcd.print(WiFi.SSID(i));
     
     
    }
  }
  Serial.println("");

  // Wait a bit before scanning again
  delay(5000);
}

วันอังคารที่ 6 กุมภาพันธ์ พ.ศ. 2561

ESP8266 NODE MCU connect I2C LCD




Wiring












I2C LCD  to ESP8266 Node MCU

GND to GND
VCC to VU
SDA to D2
SCL to D1



use example code from IDE


#include <Wire.h> 
#include <LiquidCrystal_I2C.h>

// Set the LCD address to 0x27 for a 16 chars and 2 line display
LiquidCrystal_I2C lcd(0x27, 16, 2);

void setup()
{
// initialize the LCD
lcd.begin();
}

void loop()
{
bool blinking = true;
lcd.cursor();

while (1) {
if (blinking) {
lcd.clear();
lcd.print("No cursor blink");
lcd.noBlink();
blinking = false;
} else {
lcd.clear();
lcd.print("Cursor blink");
lcd.blink();
blinking = true;
}
delay(4000);
}

}