Cov txheej txheem:

Arduino thiab ESP8266 Nrog I2c LCD Zaub: 9 Kauj Ruam
Arduino thiab ESP8266 Nrog I2c LCD Zaub: 9 Kauj Ruam

Video: Arduino thiab ESP8266 Nrog I2c LCD Zaub: 9 Kauj Ruam

Video: Arduino thiab ESP8266 Nrog I2c LCD Zaub: 9 Kauj Ruam
Video: NodeMCU V3 ESP8266 - обзор, подключение и прошивка в Arduino IDE 2024, Kaum ib hlis
Anonim
Image
Image
Arduino Ib
Arduino Ib

Peb lub hom phiaj tseem ceeb ntawm no yog los qhia kev ua haujlwm ntawm cov lej i2c module rau LCD Zaub 2x16 lossis 20x4. Nrog tus qauv no, peb tuaj yeem tswj cov lus hais los saum no thaum siv tsuas yog ob tus pin (SDA thiab SCL). Qhov no ua rau kev sib txuas lus yooj yim heev thiab tso tau ob peb lwm yam ntawm peb cov microcontroller GPIOs.

Cia peb qhia kev ua haujlwm ntawm ob qho UNO thiab ESP8266 Arduino. Txheeb nws tawm!

Kauj ruam 1: Arduino Uno

Kauj Ruam 2: WiFi ESP8266 NodeMcu ESP-12E

WiFi ESP8266 NodeMcu ESP-12E
WiFi ESP8266 NodeMcu ESP-12E

Kauj Ruam 3: 16x2 Serial LCD Zaub

16x2 Serial LCD Zaub
16x2 Serial LCD Zaub

Kauj Ruam 4: I2c Serial Module

I2c Serial Module
I2c Serial Module

Hauv ntu no, peb qhia tus adapter uas tau yuav cais. Peb welded cov zaub, uas yog zoo ib yam, nyob tom qab. Los ntawm i2c pins, cov duab yuav sib tham ncaj qha nrog Arduino. Yog li ntawd, los ntawm microcontroller, Arduino no yuav tswj hwm txhua cov lus txib rau cov zaub, ua kom yooj yim rau nws qhov kev sib txuas thiab kev ua haujlwm.

Kauj Ruam 5: I2c Serial Module Txuas nrog Cov Zaub LCD

I2c Serial Module Txuas nrog LCD Zaub
I2c Serial Module Txuas nrog LCD Zaub

Kauj Ruam 6: Txhim Kho Nrog Arduino

Mounting nrog Arduino
Mounting nrog Arduino

Kauj Ruam 7: Txhim Kho Nrog ESP8266

Mounting nrog ESP8266
Mounting nrog ESP8266

Kauj ruam 8: Tsev qiv ntawv

Ntxiv lub tsev qiv ntawv "LiquidCrystal_I2C" rau kev sib txuas lus nrog LCD zaub.

Nkag mus rau qhov txuas thiab rub lub tsev qiv ntawv.

Unzip cov ntawv thiab muab tso rau hauv cov ntawv qiv ntawm Arduino IDE.

C: / Program Files (x86) / Arduino / qiv

Kauj ruam 9: Source Code

Peb pib los ntawm kev txhais cov tsev qiv ntawv thiab qhov peb yuav siv nrog peb cov cai.

#include // responsável pela comunicação com lub interface i2c

#include // responsivevel pela comunicação com o display LCD // Inicializa o display no endereço 0x27 // os demais parâmetros, sáo necessários para o módulo conversar com o LCD // porém podemos utilizar os pinos normalmente sem interferência // parâmetro: POSITIVE> > Backligh LIGADO | NEGATIVE>> Backlight desligado LiquidCrystal_I2C lcd (0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);

Teeb

Ntawm no, peb yuav tsuas yog pib peb lub hom phiaj rau kev sib txuas lus nrog cov zaub.

void teeb tsa ()

{// inicializa o zaub (16 colunas x 2 linhas) lcd.begin (16, 2); // ou 20, 4 se rau o zaub 20x4}

Loop

Peb qhov haujlwm yuav ua rau cov duab ntsais muag txhua 1 thib ob. Nov yog qhov haujlwm yooj yim uas twb tau cuam tshuam nrog txhua yam peb xav tau los sib tham nrog cov zaub.

Qhib / tua lub teeb rov qab, tso tus cursor rau kev sau ntawv.

void lub voj ()

{// acende o backlight ua LCD lcd.setBacklight (HIGH); // posiciona o cursor para escrita //.setCursor(coluna, linha) lcd.setCursor (0, 0); lcd.print ("FERNANDOK. COM"); lcd.setCursor (0, 1); lcd.print ("ACESSE !!!"); ncua (1000); // intervalo de 1s // desliga o backlight ua LCD lcd.setBacklight (LOW); ncua (1000); // intervalo de 1s}

Pom zoo: