Cov txheej txheem:
- Kauj ruam 1: Txheej txheem cej luam
- Kauj ruam 2: Yam Koj Xav Tau / Txuas
- Kauj Ruam 3: Daim duab Circuit Court
- Kauj ruam 4: Programming - Kuv
- Kauj ruam 5: Programming - II
- Kauj ruam 6: Yees duab
Video: Daim ntawv thov MCP-23008 Siv Kev Sib Txuas Sib Txuas (I2C) :: 6 Kauj Ruam
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:26
Nyob zoo
Nyob zoo os.. !!
Kuv (Somanshu Choudhary) sawv cev ntawm Dcube thev naus laus zis kev lag luam mus rau kev tswj hwm ntawm I2C raws tu qauv siv Arduino nano thiab MCP23008.
Kauj ruam 1: Txheej txheem cej luam
- Cov cuab yeej MCP23X08 muab 8-ntsis, lub hom phiaj dav, nthuav dav I/O nthuav dav rau I2C tsheb npav lossis daim ntawv thov SPI.
- MCP23X08 muaj ntau yam 8-ntsis teeb tsa cov npe rau kev tawm tswv yim, tso tawm thiab xaiv polarity. Tus txheej txheem txheej txheem tuaj yeem ua haujlwm rau I/Os li kev nkag los lossis tawm los ntawm kev sau I/O teeb tsa me ntsis. Cov ntaub ntawv rau txhua qhov kev tawm tswv yim lossis tso tawm raug khaws cia hauv qhov sib nkag tau nkag los lossis tso tawm npe. Lub polarity ntawm Kev Nkag Mus Nkag Chaw Nkag tuaj yeem hloov pauv nrog Polarity Inversion register. Txhua qhov sau npe tuaj yeem nyeem los ntawm tus txheej txheem.
- DATASHEET LINK:
Kauj ruam 2: Yam Koj Xav Tau / Txuas
1. Arduino Nano LINK:
2. Siv thaiv rau Arduino Nano LINK:
3. USB Cable Hom A rau Micro Hom B 6 Taw Ntev
4. I²C Cable LINK:
5. Yim SPDT I²C Tswj Kev Tshaj Tawm
6. Adapter LINK:
Kauj Ruam 3: Daim duab Circuit Court
Kauj ruam 4: Programming - Kuv
- Hauv txoj cai no, Kuv siv Txoj Haujlwm Pabcuam Txheej Txheem
- Kuv siv cov tab sib txawv rau kev txhais lub luag haujlwm thiab kev hu xov tooj
CODE UNDER TAB Q:
// Yooj yim ua haujlwm hu xov tooj
#suav nrog qhov tsis muaj teeb tsa teeb tsa ()
{
// I2C chaw nyob ntawm MCP23008
#txhais MCP_ADDR 0x20
// Koom nrog I2C Bus li tus tswv
Hlau.begin ();
// Pib kev sib txuas lus txuas thiab teeb tsa tus nqi
Serial.begin (9600);
// Pib kis nrog cov khoom siv ntawm I2C npav
Wire.beginTransmission (MCP_ADDR);
// Xaiv IODIR - I/O DIRECTION REGISTER sau npe
Hlau.write (0x00);
// Xaiv qhov yuav tsum tau ua haujlwm (tso tawm)
Hlau.write (0x00);
// Xaiv CONFIGURATION sau npe
Hlau.write (0x05);
// Xaiv qhov yuav tsum tau ua haujlwm
Hlau.write (0x0E);
// kawg kis
Wire.endTransmission ();
}
void lub voj ()
{
a1_on ();
ncua (1000);
a1_off ();
ncua (1000);
a2_on ();
ncua (1000);
a2_off ();
ncua (1000);
a3_on ();
ncua (1000);
a3_off ();
ncua (1000);
a4_on ();
ncua (1000);
a4_off ();
ncua (1000);
a5_on ();
ncua (1000);
a5_off ();
ncua (1000);
a6_on ();
ncua (1000);
a6_off ();
ncua (1000);
a7_on ();
ncua (1000);
a7_off ();
ncua (1000);
a8_on ();
ncua (1000);
a8_off ();
}
CODE UNDER TAB Q1:
// Tus lej no yog rau thiab tawm relay 1 ntawm lub nkoj
void a1_on () {
// Pib kis
Wire.beginTransmission (MCP_ADDR);
Hlau.write (0x09);
Hlau.write (0x01);
ncua (1800);
Wire.requestFrom (MCP_ADDR, 1);
int GPIO = Hlau.read ();
Wire.endTransmission ();
// Tso tawm rau lub vijtsam
Serial.print ("GPIO tus nqi:");
Serial.println (GPIO, BIN);
}
tsis muaj dab tsi a1_off ()
{
// Pib kis
Wire.beginTransmission (MCP_ADDR);
Hlau.write (0x09);
Hlau.write (0x00);
ncua (1800);
Wire.requestFrom (MCP_ADDR, 1);
int GPIO = Hlau.read ();
Wire.endTransmission ();
// Tso tawm rau lub vijtsam
Serial.print ("GPIO tus nqi:");
Serial.println (GPIO, BIN);
}
CODE UNDER TAB Q2:
// Tus lej no yog rau thiab tawm relay 2 ntawm lub nkoj
void a2_on () {
// Pib kis
Wire.beginTransmission (MCP_ADDR);
Hlau.write (0x09);
Hlau.write (0x02);
ncua (1800);
Wire.requestFrom (MCP_ADDR, 1);
int GPIO = Hlau.read ();
Wire.endTransmission ();
// Tso tawm rau lub vijtsam
Serial.print ("GPIO tus nqi:");
Serial.println (GPIO, BIN);
}
tsis muaj dabtsis a2_off ()
{
// Pib kis
Wire.beginTransmission (MCP_ADDR);
Hlau.write (0x09);
Hlau.write (0x00);
ncua (1800);
Wire.requestFrom (MCP_ADDR, 1);
int GPIO = Hlau.read ();
Wire.endTransmission ();
// Tso tawm rau lub vijtsam
Serial.print ("GPIO tus nqi:");
Serial.println (GPIO, BIN);
}
CODE UNDER TAB q3: // Tus lej no yog rau thiab tawm relay 3 ntawm lub nkoj
tsis muaj dab tsi a3_on ()
{
// Pib kis
Wire.beginTransmission (MCP_ADDR);
Hlau.write (0x09);
Hlau.write (0x04);
ncua (1800);
Wire.requestFrom (MCP_ADDR, 1);
int GPIO = Hlau.read ();
Wire.endTransmission ();
// Tso tawm rau lub vijtsam
Serial.print ("GPIO tus nqi:");
Serial.println (GPIO, BIN);
}
tsis muaj dab tsi a3_off ()
{
// Pib kis
Wire.beginTransmission (MCP_ADDR);
Hlau.write (0x09);
Hlau.write (0x00);
ncua (1800);
Wire.requestFrom (MCP_ADDR, 1);
int GPIO = Hlau.read ();
Wire.endTransmission ();
// Tso tawm rau lub vijtsam
Serial.print ("GPIO tus nqi:");
Serial.println (GPIO, BIN);
}
Kauj ruam 5: Programming - II
CODE UNDER TAB Q4:
// Tus lej no yog rau thiab tawm relay 4 ntawm lub nkoj
tsis muaj dab tsi a4_on ()
{
// Pib kis
Wire.beginTransmission (MCP_ADDR);
Hlau.write (0x09);
Hlau.write (0x08);
ncua (1800);
Wire.requestFrom (MCP_ADDR, 1);
int GPIO = Hlau.read ();
Wire.endTransmission ();
// Tso tawm rau lub vijtsam
Serial.print ("GPIO tus nqi:");
Serial.println (GPIO, BIN);
}
tsis muaj dab tsi a4_off ()
{
// Pib kis
Wire.beginTransmission (MCP_ADDR);
Hlau.write (0x09);
Hlau.write (0x00);
ncua (1800);
Wire.requestFrom (MCP_ADDR, 1);
int GPIO = Hlau.read ();
Wire.endTransmission ();
// Tso tawm rau lub vijtsam
Serial.print ("GPIO tus nqi:");
Serial.println (GPIO, BIN);
}
CODE UNDER TAB Q5:
// Tus lej no yog rau thiab tawm relay 5 ntawm lub nkoj
tsis muaj dab tsi a5_on ()
{
// Pib kis
Wire.beginTransmission (MCP_ADDR);
Hlau.write (0x09);
Hlau.write (0x10);
ncua (1800);
Wire.requestFrom (MCP_ADDR, 1);
int GPIO = Hlau.read ();
Wire.endTransmission ();
// Tso tawm rau lub vijtsam
Serial.print ("GPIO tus nqi:");
Serial.println (GPIO, BIN);
}
tsis muaj dabtsis a5_off ()
{
// Pib kis
Wire.beginTransmission (MCP_ADDR);
Hlau.write (0x09);
Hlau.write (0x00);
ncua (1800);
Wire.requestFrom (MCP_ADDR, 1);
int GPIO = Hlau.read ();
Wire.endTransmission ();
// Tso tawm rau lub vijtsam
Serial.print ("GPIO tus nqi:");
Serial.println (GPIO, BIN);
}
CODE UNDER TAB q6: // Tus lej no yog rau thiab tawm relay 6 ntawm lub nkoj
tsis muaj dab tsi a6_on ()
{
// Pib kis
Wire.beginTransmission (MCP_ADDR);
Hlau.write (0x09);
Hlau.write (0x20);
ncua (1800);
Wire.requestFrom (MCP_ADDR, 1);
int GPIO = Hlau.read ();
Wire.endTransmission ();
// Tso tawm rau lub vijtsam
Serial.print ("GPIO tus nqi:");
Serial.println (GPIO, BIN);
}
tsis muaj dab tsi a6_off ()
{
// Pib kis
Wire.beginTransmission (MCP_ADDR);
Hlau.write (0x09);
Hlau.write (0x00);
ncua (1800);
Wire.requestFrom (MCP_ADDR, 1);
int GPIO = Hlau.read ();
Wire.endTransmission ();
// Tso tawm rau lub vijtsam
Serial.print ("GPIO tus nqi:");
Serial.println (GPIO, BIN);
}
CODE UNDER TAB q7: // Tus lej no yog rau thiab tawm relay 7 ntawm lub nkoj
void a7_on () {
// Pib kis
Wire.beginTransmission (MCP_ADDR);
Hlau.write (0x09);
Hlau.write (0x40);
ncua (1800);
Wire.requestFrom (MCP_ADDR, 1);
int GPIO = Hlau.read ();
Wire.endTransmission ();
// Tso tawm rau lub vijtsam
Serial.print ("GPIO tus nqi:");
Serial.println (GPIO, BIN);
}
tsis muaj dab tsi a7_off ()
{
// Pib kis
Wire.beginTransmission (MCP_ADDR);
Hlau.write (0x09);
Hlau.write (0x00);
ncua (1800);
Wire.requestFrom (MCP_ADDR, 1);
int GPIO = Hlau.read ();
Wire.endTransmission ();
// Tso tawm rau lub vijtsam
Serial.print ("GPIO tus nqi:");
Serial.println (GPIO, BIN);
}
CODE UNDER TAB q8: // Tus lej no yog rau thiab tawm relay 8 ntawm lub nkoj
void a8_on () {
// Pib kis
Wire.beginTransmission (MCP_ADDR);
Hlau.write (0x09);
Hlau.write (0x80);
ncua (1800);
Wire.requestFrom (MCP_ADDR, 1);
int GPIO = Hlau.read ();
Wire.endTransmission ();
// Tso tawm rau lub vijtsam
Serial.print ("GPIO tus nqi:");
Serial.println (GPIO, BIN);
}
tsis muaj dab tsi a8_off ()
{
// Pib kis
Wire.beginTransmission (MCP_ADDR);
Hlau.write (0x09);
Hlau.write (0x00);
ncua (1800);
Wire.requestFrom (MCP_ADDR, 1);
int GPIO = Hlau.read ();
Wire.endTransmission ();
// Tso tawm rau lub vijtsam
Serial.print ("GPIO tus nqi:");
Serial.println (GPIO, BIN);
}
Kauj ruam 6: Yees duab
Yog xav paub ntxiv thov mus saib peb lub xaib:
www.dcubetechnologies.com
Pom zoo:
LoRa-Raws Li Pom Kev Pom Kev Pom Zoo rau Kev Ua Liaj Ua Teb Iot - Tsim Tsim Daim Ntawv Thov Ua Ntej Siv Firebase & Angular: 10 Kauj Ruam
LoRa-Raws Li Pom Kev Pom Kev Pom Zoo rau Kev Ua Liaj Ua Teb Iot | Tsim Tsim Daim Ntawv Thov Ua Ntej Siv Firebase & Angular: Hauv tshooj yav dhau los peb tham txog yuav ua li cas cov ntsuas hluav taws xob ua haujlwm nrog loRa module txhawm rau nthuav tawm firebase Lub Sijhawm Teem Sijhawm, thiab peb tau pom daim duab siab heev tias peb txoj haujlwm tag nrho ua haujlwm li cas. Hauv tshooj lus no peb yuav tham txog yuav ua li cas peb tuaj yeem
Ib Daim Ntawv Thov ntawm Kev Txuas Txuas Ntxiv Nrog Kev Tawm Tswv Yim: 7 Cov Kauj Ruam (nrog Duab)
Ib Daim Ntawv Thov ntawm Kev Txuas Txuas Ntxiv Nrog Kev Tawm Tswv Yim: Hauv qhov kev qhia no, peb thawj zaug yuav qhia koj yuav siv Arduino Uno li cas los tswj lub zog kev co ntawm lub pob txuas ntxiv. Feem ntau cov lus qhia ntawm lub laub khawm cuam tshuam nrog lub khawm ntawm lub khob cij lub cev, qhov nyob hauv qhov kev qhia no, lub pob tau
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
Kev Sib Txuas Txuas Txuas Txuas Siv Bluefruit: 4 Cov Kauj Ruam
Kev Sib Txuas Tsis Sib Txuas Siv Bluefruit: Nov yog cov lus qhia yooj yim los ntawm kauj ruam qhia los hloov koj cov xov hlau nrog bluetooth tsis muaj zog txuas: Nws coj kuv ib pliag los daws qhov no vim tias tsis muaj cov ntaub ntawv hais txog kev ua qhov no nrog bluetooth niaj hnub tsis muaj zog thev naus laus zis raws li Bluefrui
EZ Kev Sib Txuas Txuas Txuas Txuas Ntxiv - Tsis Muaj Tus Kheej! (CSRC-311): 7 Kauj Ruam
EZ Kev Sib Txuas Txuas Txuas Txuas Ntxiv - Tsis Muaj Tus Kheej! (CSRC-311): Tsis ntev dhau los ntawm Azamom.com (thov txim, tam sim no tau muag tawm) Kuv tau hla qhov kev pom zoo zoo ntawm Common Sense RC CSRC-311 tus qauv-siv servos.Noj zoo, Kuv xav hloov qee yam ntawm tsis tu ncua kev sib hloov. Txoj kev kuv tuaj nrog yog yooj yim heev thiab xav tau