Cov txheej txheem:
- Kauj Ruam 1: Cov Cheeb Tsam Yuav Tsum Tau
- Kauj ruam 2: Kev sib txuas
- Kauj ruam 3: Code
- Kauj Ruam 4: Cov Zis
Video: Siv 16x2 LCD Nrog I2C: 4 Kauj Ruam
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:27
Hauv ib qho ntawm kuv Cov Lus Qhia yav dhau los, Kuv tau qhia koj yuav ua li cas txuas thiab cuam tshuam LCD rau Arduino Uno thiab tso saib qhov tseem ceeb ntawm nws. Tab sis raws li tau pom, muaj ntau qhov kev sib txuas thiab yog tias txoj haujlwm pib tau txais kev ntxhov siab ntau vim muaj xov hlau ntau dhau.
Hauv Cov Lus Qhia no, Kuv yuav qhia koj li cas txuas lub LCD rau I2C, uas yuav tsuas muaj 4 tus pin los tswj thiab siv LCD. Yog li cia peb pib.
Kauj Ruam 1: Cov Cheeb Tsam Yuav Tsum Tau
Rau qhov haujlwm no koj yuav xav tau:
- Arduino Ib
- 16x2 LCD Zaub
- I2C rau 16x2 LCD
- Hook-Up xov hlau
Nrog rau tag nrho cov no, cia peb nkag mus rau hauv qhov txuas.
Kauj ruam 2: Kev sib txuas
Xa cov duab thiab ua kom muaj kev sib txuas. Nws yog qhov yooj yim heev, koj tsuas yog yuav tsum ntsaws I2C hauv cov chaw nres nkoj ntawm LCD thiab muab nws tso rau hauv qhov chaw. Tom qab ntawd txuas SCL tus pin rau A4 tus pin ntawm Arduino thiab SDA tus pin rau A5 tus pin ntawm Arduino.
Kuv tsis siv lub I2C li kuv twb tau siv lub taub hau taub hau ntawm lub LCD. Tab sis kuv yuav hais kom siv lub I2C ntawm LCD
Kauj ruam 3: Code
Muaj LCD I2C tus tswv tsev qiv ntawv suav nrog hauv Arduino IDE. Tab sis muaj teeb meem me me nrog cov cai hauv nws. Txhua qhov piv txwv hauv lub tsev qiv ntawv no xav tias qhov chaw nyob tsis raug ntawm I2C li 0x27. Yog li ua ntej peb yuav tsum nrhiav seb qhov chaw nyob ntawm peb I2C yog dab tsi. Peb tuaj yeem ua qhov no los ntawm kev siv I2C scanner code. Thaum peb muaj I2C chaw nyob peb tuaj yeem hloov tus nqi no hauv tus piv txwv code thiab pib siv nws.
I2C Scanner Code:
#suav nrog
teeb tsa tsis muaj dabtsis () {Wire.begin (); Serial.begin (9600); thaum (! Serial); // tos saib daim ntawv Serial.println ("\ nI2C Scanner"); } void loop () {byte yuam kev, chaw nyob; koj nDevices; Serial.println ("Luam theej duab …"); nDevices = 0; rau (chaw nyob = 1; chaw nyob <127; chaw nyob ++) {// Tus i2c_scanner siv tus nqi rov qab los ntawm // Tus Sau.endTransmisstion kom pom tias // lub cuab yeej puas lees paub rau qhov chaw nyob. Wire.beginTransmission (chaw nyob); yuam kev = Wire.endTransmission (); yog (yuam kev == 0) {Serial.print ("I2C ntaus ntawv pom ntawm qhov chaw nyob 0x"); yog (chaw nyob <16) Serial.print ("0"); Serial.print (chaw nyob, HEX); Serial.println ("!"); nDevices ++; } lwm yog (yuam kev == 4) {Serial.print ("Tsis paub qhov yuam kev ntawm qhov chaw 0x"); yog (chaw nyob <16) Serial.print ("0"); Serial.println (chaw nyob, HEX); }} yog (nDevices == 0) Serial.println ("Tsis pom I2C li pom / n"); lwm tus Serial.println ("ua tiav / n"); ncua (5000); // tos 5 vib nas this rau tom ntej scan}
Piv txwv Code (Txhawm rau pom cov cim nkag rau hauv Serial Monitor):
#ncig #ncig
LiquidCrystal_I2C lcd (0x3F, 20, 4); // teeb tsa qhov chaw nyob LCD rau 0x27 rau 16 tus cim thiab 2 kab lus tso tawm
void teeb tsa ()
{lcd.init (); // pib lub lcd lcd.backlight (); Serial.begin (9600); }
void lub voj ()
{// thaum cov cim tuaj txog ntawm qhov chaw nres nkoj… yog (Serial.available ()) {// tos me ntsis rau tag nrho cov lus kom tuaj txog qeeb (100); // tshem qhov screen lcd.clear (); // nyeem tag nrho cov cim muaj thaum (Serial.available ()> 0) {// tso saib txhua lub cim rau LCD lcd.write (Serial.read ()); }}}
Kauj Ruam 4: Cov Zis
Thaum koj tau xa cov cai, koj npaj txhij mus. Txog qhov Kev Qhia Kuv tau coj tus piv txwv ntawm Cov Cai Sau Tus Qauv. Yog li tam sim no tom qab rub tawm cov cai, qhib Serial Monitor thiab ntaus ib lo lus thiab nyem "xa". Tam sim no koj yuav tsum pom tus nqi no nthuav tawm ntawm LCD.
Pom zoo:
Txawb Xov Tooj Siv Yooj Yim Siv STM32F407 Cov Khoom Siv Tshawb Pom thiab GSM A6 Module: 14 Cov Kauj Ruam (nrog Duab)
Kev Siv Xov Tooj Ntawm Lub Xov Tooj Siv STM32F407 Cov Khoom Siv Tshawb Pom thiab GSM A6 Module: Koj puas tau xav tsim qhov kev ua kom txias txias? Yog tias yog, ua li cas txog kev tsim ib qho ntawm cov neeg nyiam tshaj plaws thiab txhua tus nyiam cov khoom siv xws li Lub Xov Tooj Txawb !!!. Hauv Cov Lus Qhia no, Kuv yuav qhia koj yuav tsim lub xov tooj txawb yooj yim siv STM li cas
I2C / IIC LCD Zaub - Siv SPI LCD rau I2C LCD Zaub Siv SPI rau IIC Module Nrog Arduino: 5 Kauj Ruam
I2C / IIC LCD Zaub | Siv SPI LCD rau I2C LCD Zaub Siv SPI rau IIC Module Nrog Arduino: Nyob zoo cov phooj ywg txij li ib txwm muaj SPI LCD 1602 muaj xov tooj ntau dhau los txuas yog li nws nyuaj rau cuam tshuam nrog arduino tab sis muaj ib qho qauv muaj nyob hauv khw uas tuaj yeem hloov SPI zaub rau hauv IIC zaub yog li ntawd koj yuav tsum txuas tsuas yog 4 xov hlau
Animation ntawm 16x2 I2c LCD Siv STM32 Nucleo: 4 Kauj Ruam
Animation ntawm 16x2 I2c LCD SINGING STM32 Nucleo: Nyob zoo cov phooj ywg, qhov no yog kev qhia qhia txog yuav ua li cas thiaj tsim tau cov tsiaj ntawv tshwj xeeb ntawm 16x2 i2c LCD.There muaj ob peb yam uas xav tau rau txoj haujlwm, yog li yog koj nkag mus rau txoj cai koj tuaj yeem ua tiav nws hauv 1 teev Tom qab ua raws cov lus qhia no koj yuav yog abl
Arduino Neeg Hlau Nrog Kev Nyob, Kev Qhia thiab Qib Kev Sib Hloov (Sab Hnub Poob, Sab Hnub Poob, Sab Qaum Teb, Sab Qab Teb) Tswj los ntawm Lub Suab Siv Bluetooth Module thiab Kev Siv Tus Neeg Siv Hluav Taws Xob: 6 Kauj Ruam
Arduino Neeg Hlau Nrog Kev Nyob, Kev Qhia thiab Qib Kev Sib Hloov (Sab Hnub Poob, Sab Hnub Poob, Sab Qaum Teb, Sab Qab Teb) Tswj los ntawm Lub Suab Siv Bluetooth Module thiab Kev Siv Tus Neeg Siv Hluav Taws Xob: Cov lus qhia no piav qhia yuav ua li cas thiaj tsim tau Arduino Robot uas tuaj yeem txav mus raws qhov xav tau (Forward, Backward) , Sab laug, Txoj Cai, Sab Hnub Poob, Sab Hnub Poob, Sab Qaum Teb, Sab Qab Teb) xav tau Kev nrug deb hauv Centimeters siv lub suab hais kom ua. Neeg hlau kuj tseem tuaj yeem txav tau tus kheej
Lub Suab Siv Cov Khoom Siv Media Siv Alexa: 9 Kauj Ruam (nrog Duab)
Lub Suab Siv Cov Khoom Siv Media Siv Alexa: Chav tsim los ntawm no ua rau koj cov cuab yeej siv xws li TV, tshuab raj, CD thiab DVD players tswj nrog lub suab txib siv Alexa thiab Arduino. Qhov zoo ntawm chav tsev no yog tias koj yuav tsum tsuas yog muab lub suab lus txib. Chav tsev no tuaj yeem ua haujlwm nrog txhua yam khoom siv tha