Cov txheej txheem:

I2C LCD ESP8266: 6 Cov Kauj Ruam
I2C LCD ESP8266: 6 Cov Kauj Ruam

Video: I2C LCD ESP8266: 6 Cov Kauj Ruam

Video: I2C LCD ESP8266: 6 Cov Kauj Ruam
Video: #5 Жидкокристаллический дисплей I2C || ESP8266 FLPROG ЛЕСТНИЧНАЯ ЛОГИКА 2024, Hlis ntuj nqeg
Anonim
I2C LCD ESP8266
I2C LCD ESP8266
I2C LCD ESP8266
I2C LCD ESP8266
I2C LCD ESP8266
I2C LCD ESP8266

Peb ua ntau ESP8266 raws cov phiaj xwm, thiab txawm hais tias feem ntau ntawm lawv yog rau IOT thiab lub vev xaib raws cov phiaj xwm, nws yooj yim kom muaj lub vijtsam LCD hauv cheeb tsam kom pom dab tsi tshwm sim.

I2C zoo meej rau I/O cov cuab yeej yam tsis muaj I/O pins muaj ntau, vim nws tsuas yog siv ob tus I/O tus pin. Cov qauv LCD no muaj ntau, tab sis muaj ntau qhov chaw nyob, yog li cia peb tau txais kev sib txuas lus nrog ESP8266, txuas lub vijtsam rau esp8266 module, thiab khiav I2C chaw nyob scanner kom pom qhov chaw nyob uas peb xav tham nrog. Cov theem hauv qab no yuav ua rau koj txheeb.

Kuv tab tom siv Adafruit Feather HUZZAH ESP8266 module, thiab Sunfounder 20x4 xiav LCD.

Kauj Ruam 1: Ntxiv ESP8266 rau Koj Arduino IDE

Ntxiv ESP8266 rau koj Arduino IDE
Ntxiv ESP8266 rau koj Arduino IDE

Ua ntej koj tuaj yeem siv ESP8266 nrog Arduino IDE, koj yuav tsum ntxiv kev txhawb nqa rau ESP8266 (pom hauv "tus thawj tswj hwm pawg thawj coj url" teb saum toj no). Adafruit muab cov kev qhia qhia rau cov qib no ntawm

Kauj Ruam 2: I2C LCD Library

I2C LCD Library
I2C LCD Library

Koj yuav tsum tau ua kom ntseeg tau tias koj tau txais I2C LCD tsev qiv ntawv los ntawm https://github.com/marcoschwartz/LiquidCrystal_I2…, txwv tsis pub cov cai yuav tsis upload. Koj tuaj yeem tau txais lus ceeb toom tias lub tsev qiv ntawv tsuas yog ntawv pov thawj rau AVR's, tab sis nws tseem ua haujlwm tau zoo ntawm ESP8266.

Luam cov ntaub ntawv, thiab theej lawv mus rau "I2C LCD" nplaub tshev hauv cov tsev qiv ntawv nplaub tshev hauv koj daim nplaub tshev daim duab (tau teev tseg hauv "nyiam - qhov chaw sketchbook" raws li pom saum toj no).

Kauj Ruam 3: Txuas lub LCD

Txuas lub LCD
Txuas lub LCD
Txuas lub LCD
Txuas lub LCD

ESP8266 thiab LCD module tau hais meej cov cim npe, yog li txuas raws li hauv qab no:

SCL - SCL

SDA - SDA

VCC - USB (yog, nws yog 5v, tab sis I2C ntawm 3.3v ESP8266 tsis yws)

Gnd - Yog

Nco ntsoov: VCC yuav tsum yog 5v tshwj tsis yog tias koj muaj 3.3v tso saib tau. Tsis muaj qib hloov pauv tsim nyog rau I2C pins.

Kauj Ruam 4: Luam theej I2C Bus rau Qhov Chaw Nyob raug

Luam theej I2C Bus rau Qhov Chaw Nyob
Luam theej I2C Bus rau Qhov Chaw Nyob

I2C yog ob txoj kab hlau txuas uas tso cai rau siv ntau yam khoom siv, nrog tsuas yog ob tus pin siv ntawm lub microcontroller. Qhov no ua tiav los ntawm kev teeb tsa chaw nyob ntawm txhua lub cuab yeej ntawm lub npav. Tsis yog txhua I2C LCD siv tib qhov chaw nyob.

Muaj qhov chaw nyob scanner code koj tuaj yeem ua haujlwm uas yuav tshaj tawm qhov chaw nyob txhua qhov khoom siv I2C txuas nrog. Koj tuaj yeem tau txais tus lej rau I2C scanner ntawm

Kev xa cov duab kos pom kuv hauv cov ntawv saib uas kuv tau siv chaw nyob 0x27, yog li kuv tau rub cov duab hauv qab no thiab ua kom ntseeg tau tias nws tau sim sib tham ntawm qhov chaw nyob raug, thiab qhov loj me. Qhov loj me ntawm cov vijtsam yog 20x4, thiab 16x2.

LiquidCrystal_I2C lcd (0x27, 20, 4);

Kauj Ruam 5: Tshaj Tawm Cov Ntawv ntawm Koj Lub LCD

Luam tawm cov ntawv ntawm koj lub LCD
Luam tawm cov ntawv ntawm koj lub LCD

Kuv tau suav nrog cov qauv kos duab los qhia koj yuav ua li cas tso tawm cov ntawv ntawm koj lub LCD.

Koj tuaj yeem tau txais txoj cai rau I2C LCD ntawm

Tus yuam sij kom tau txais qhov tso tawm qhov twg koj xav tau yog kab ntawv tau teeb ua ntej, tom qab ntawv tus lej kab, ob qho pib ntawm 0.

// Txav tus cursor 5 tus cim mus rau sab xis thiab // xoom cim qis (kab 1).

lcd.setCursor (5, 0);

// Luam tawm HELLO rau lub vijtsam, pib ntawm 5, 0.

lcd.print ("HLO");

Kauj Ruam 6: Cov Lus Qhia Ntxiv

Koj tuaj yeem kawm paub ntau ntxiv txog kev siv ESP8266 nrog Arduino IDE ntawm

Thiab kawm paub tswj hwm koj li ESP8266 nrog Amazon Alexa/Echo platform ntawm

Pom zoo: