Cov txheej txheem:
- Kauj Ruam 1: Yam Koj Xav Tau..
- Kauj Ruam 2: Kev Sib Txuas:
- Kauj ruam 3: Code:
- Kauj Ruam 4: Cov ntawv thov:
Video: Raspberry Pi - PCA9536 Kev Tawm Tswv Yim/Tso Tawm Expander Java Qhia: 4 Kauj Ruam
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:26
PCA9536 yog 8-tus pin CMOS ntaus ntawv uas muab 4 lub ntsis ntawm Lub Hom Phiaj Dav Dav thaum uas tig mus Kev Tawm/Tawm (GPIO) nthuav dav rau I2C-npav/SMBus daim ntawv thov. Nws suav nrog 4-ntsis Kev teeb tsa sau npe los ua haujlwm lub hom phiaj ntawm kev xaiv tswv yim lossis xaiv tawm, 4-ntsis Kev Nkag Nkag Chaw Nkag Nkag, 4-ntsis Chaw Tso Tawm Chaw Tso Npe thiab 4-ntsis Polarity Inversion register active HIGH lossis nquag ua haujlwm LOW. Nov yog nws qhov ua piv txwv nrog raspberry pi siv java code.
Kauj Ruam 1: Yam Koj Xav Tau..
1. Raspberry Pi
2. PCA9536
LINK:
3. I²C Cable
LINK:
4. I²C Shield rau Raspberry Pi
LINK:
5. Ethernet Cable
Kauj Ruam 2: Kev Sib Txuas:
Siv daim I2C daim thaiv rau raspberry pi thiab maj mam thawb nws hla gpio pins ntawm raspberry pi.
Tom qab ntawd txuas ib qho kawg ntawm I2C cable rau PCA9536 sensor thiab lwm qhov kawg rau I2C daim ntaub thaiv.
Kuj txuas Ethernet cable rau pi lossis koj tuaj yeem siv WiFi module.
Kev sib txuas tau qhia hauv daim duab saum toj no.
Kauj ruam 3: Code:
Tus lej java rau PCA9536 tuaj yeem rub tawm los ntawm peb qhov chaw cia khoom github- Dcube Store
Nov yog qhov txuas rau tib yam:
github.com/DcubeTechVentures/PCA9536/blob/master/Java/PCA9536.java
Peb tau siv pi4j tsev qiv ntawv rau java code, cov kauj ruam rau nruab pi4j ntawm raspberry pi tau piav qhia ntawm no:
pi4j.com/install.html
Koj tseem tuaj yeem luam cov cai los ntawm no, nws tau muab raws li hauv qab no:
// Faib nrog daim ntawv tso cai yuav dawb.
// Siv nws txhua txoj hauv kev uas koj xav tau, muaj txiaj ntsig lossis pub dawb, muab nws haum rau hauv daim ntawv tso cai ntawm nws cov haujlwm ua haujlwm.
TIAB SA 9536
// Tus lej no yog tsim los ua haujlwm nrog PCA9536_I2CIO I2C Mini Module muaj los ntawm ControlEverything.com.
//
ntshuam com.pi4j.io.i2c. I2CBus;
ntshuam com.pi4j.io.i2c. I2CDevice;
ntshuam com.pi4j.io.i2c. I2CFactory;
ntshuam java.io. IOException;
chav kawm pej xeem PCA9536
{
pej xeem zoo li qub tsis muaj dab tsi tseem ceeb (Txoj hlua args ) cuam tshuam zam
{
// Tsim I2C npav
I2CBus Bus = I2CFactory.getInstance (I2CBus. BUS_1);
// Tau txais I2C ntaus ntawv, PCA9536 I2C chaw nyob yog 0x41 (65)
I2CDevice ntaus ntawv = Bus.getDevice (0x41);
// Xaiv cov npe sau npe
// Txhua tus pin teeb tsa ua tswv yim
device.write (0x03, (byte) 0xFF);
// Tso tawm rau lub vijtsam
System.out.printf ("Txhua lub xeev Pins yog HIGH %n");
Xov.sleep (500);
// Nyeem 1 byte ntawm cov ntaub ntawv
byte cov ntaub ntawv = tshiab byte [1];
cov ntaub ntawv [0] = (byte) device.read (0x00);
// Hloov cov ntaub ntawv mus rau 4-khoom
int data1 = (data [0] & 0x0F);
rau (int i = 0; i <4; i ++)
{
yog ((data1 & (int) Math.pow (2, i))) == 0)
{
System.out.printf ("I/O Pin %d State is LOW %n", i);
}
lwm tus
{
System.out.printf ("I/O Pin %d State is HIGH %n", i);
Xov.sleep (500);
}
}
}
}
Kauj Ruam 4: Cov ntawv thov:
PCA9536 tuaj yeem ua haujlwm ua I/O nthuav dav. Nws muab kev daws teeb meem yooj yim thaum xav tau cov tswv yim ntxiv/tso tawm. Feem ntau nws tau ua haujlwm hauv cov kab ke uas xav tau kev nthuav dav rau ACPI lub zog hloov pauv, ntsuas ntsuas, thawb khawm, LEDs, kiv cua, thiab lwm yam.
Pom zoo:
DIY PC Steering Log thiab Pedals Los Ntawm Cardboard! (Kev tawm tswv yim, Paddle Shifters, Zaub) rau Kev Sib Tw Simulators thiab Kev Ua Si: 9 Kauj Ruam
DIY PC Steering Log thiab Pedals Los Ntawm Cardboard! (Cov lus tawm tswv yim, Cov Ncaws Pob Ntaus Pob, Zaub) rau Kev Sib Tw Simulators thiab Kev Ua Si: Hav txhua tus! Thaum lub sijhawm tsis txaus ntseeg no, peb txhua tus nyob ib puag ncig nrhiav ib yam dab tsi los ua. Cov xwm txheej sib tw hauv lub neej tiag tiag tau raug tso tseg thiab tau hloov nrog simulators. Kuv tau txiav txim siab los tsim qhov kev sim pheej yig uas ua haujlwm tsis muaj teeb meem, ua pov thawj
Cov Lus Qhia Ua Kom Koj Lub Tswv Yim Lub Tswv Yim Muaj Tseeb: 6 Cov Kauj Ruam (nrog Duab)
Cov Lus Qhia Kom Ua Koj Lub Tswv Yim Lub Tswv Yim: Qhov tseem ceeb tshaj plaws ntawm txoj haujlwm ua tiav yog muaj lub tswv yim zoo tiag tiag, tab sis qee zaum lub tswv yim yog qhov yooj yim! Tom qab ntawd los ua haujlwm nyuaj hauv kev ua qhov flash flash ntawm kev txawj ntse rau qee yam uas tib neeg " ooh " thiab " ah " ov
YUAV UA LI CAS YOOJ YIM YOOJ YIM YOOJ YIM YOOJ YIM YOOJ YIM TSHAJ PLAWS YOOJ YIM: 4 Cov Kauj Ruam
YUAV UA LI CAS YOOJ YIM YOOJ YIM YOOJ YIM YOOJ YIM YOOJ YIM TSHAJ PLAWS: Nyob zoo txhua tus hauv cov lus qhia no kuv yuav qhia koj yuav ua li cas kom yooj yim " SOIL DRYNESS SENSOR ". Qhuav ntawm cov av tau txheeb xyuas siv qhov taw qhia coj. Lub teeb ci wi
Yuav Ua Li Cas Txuas Lub Laub Khawm Nrog Suab Tawm Tswv Yim thiab Tso Tawm: 13 Kauj Ruam
Yuav Ua Li Cas Txuas Lub Laub Khawm Nrog Lub Suab Tawm Tawm thiab Tawm Tawm: Lub laub khawm yog ib qho ntawm cov hauv paus tseem ceeb rau kev ntes koj qhov kev ua. Koj tuaj yeem thawb lub pob kom ua ib yam dab tsi. Muaj ntau txoj hauv kev los siv cov nyees khawm hauv koj cov phiaj xwm (piv txwv li nyiag nkas nas thiab keyboard, lossis Arduino, gainer, MCK). Tsi
Yuav ua li cas rho tawm 1/4 'Cov Lus Qhia Tswv Yim Tawm ntawm Nws Kev Sib Txuas: 4 Cov Kauj Ruam
Yuav ua li cas rho tawm 1/4 'Cov Lus Qhia Tswv Yim Tawm ntawm Nws Kev Sib Txuas: Hauv cov lus qhia no, kuv yuav qhia koj yuav ua li cas kom tau txais cov lus me me ntawm 1/4' txiv neej kev txuas ntawm tus poj niam txuas. Qhov no tsuas yog tshwm sim thaum koj muaj lub xov tooj tsis zoo lossis koj muaj hmoov phem phem, thiab feem ntau yog qhov khoom kim heev kom tau kho tus txiv neej