Yuav Ua Li Cas Thiaj Li Ua Kom Tau Ib Daim Qauv Ntawm Cov Key Intercom Tom Tsev

Cov txheej txheem:

Yuav Ua Li Cas Thiaj Li Ua Kom Tau Ib Daim Qauv Ntawm Cov Key Intercom Tom Tsev
Yuav Ua Li Cas Thiaj Li Ua Kom Tau Ib Daim Qauv Ntawm Cov Key Intercom Tom Tsev

Video: Yuav Ua Li Cas Thiaj Li Ua Kom Tau Ib Daim Qauv Ntawm Cov Key Intercom Tom Tsev

Video: Yuav Ua Li Cas Thiaj Li Ua Kom Tau Ib Daim Qauv Ntawm Cov Key Intercom Tom Tsev
Video: Yuav ua li cas thiaj thov tau daim ntawv tso cai los qhib business nyob rau lub nroog Minneapolis 2024, Kaum ib hlis
Anonim

Nrog kev pab ntawm Arduino, koj tuaj yeem luam daim ntawv ntawm lub pob ntseg ntawm lub ntsej muag intercom hauv tsev hauv 15 feeb, yog tias, piv txwv li, lub rooj cob qhia raug kaw, thiab tus yuam sij xav tau nrawm. Saib seb yuav ua li cas no.

Ua ib daim ntawv ntawm lub intercom yuam sij siv Arduino
Ua ib daim ntawv ntawm lub intercom yuam sij siv Arduino

Nws yog qhov tsim nyog

  • - Arduino;
  • - khoos phis tawj;
  • - qhov tseem ceeb rau intercom hom iButton lossis 1-hlau;
  • - dummy yuam sij los tsim "clone" ntawm tus yuam sij thawj;
  • - 1 resistor nrog tsis kam ntawm 2, 2 kOhm;
  • - txuas xov hlau.

Cov Lus Qhia

Kauj ruam 1

Txhua tus yuam sij rau lub intercom muaj nws tus lej - nws yog tus lej no uas ua tus cim tseem ceeb. Nws yog los ntawm tus naj npawb tseem ceeb uas lub intercom txiav txim siab - koj tus kheej lossis lwm tus. Yog li no, cov ntawv theej theej ntawm tus txheej txheem muaj raws li nram no: ua ntej koj yuav tsum paub tus lej "tso cai" tus lej, thiab tom qab ntawd muab tus lej no xa mus rau lwm tus yuam sij - ib qho clone. Nws ua rau tsis muaj qhov sib txawv rau lub intercom txawm tias tus yuam sij thawj lossis nws daim ntawv txuas nrog. Tom qab kuaj xyuas tus xov tooj nrog nws cov lej tso cai, nws yuav qhib qhov rooj.

Cov yuam sij rau lub intercom, uas peb yuav txuas mus rau Arduino (qee zaum hu ua iButton los yog Kov Nco), tau nyeem thiab sau dhau ntawm 1-xaim 1-xaim interface. Yog li ntawd, daim duab hlau txuas hluav taws xob yooj yim heev. Peb tsuas xav tau ib khub ntawm xaim thiab 2.2K rub tawm-up resistor. Daim duab kos tau qhia hauv daim duab.

Peb txuas tus yuam sij rau intercom rau Arduino
Peb txuas tus yuam sij rau intercom rau Arduino

Kauj ruam 2

Txhawm rau ua haujlwm nrog 1-xaim xaim hluav taws xob, muaj cov tsev qiv ntawv npaj rau Arduino. Koj tuaj yeem siv, piv txwv li no: https://www.pjrc.com/teensy/arduino_libraries/OneWire.zip. Rub tawm qhov khaws cia thiab khaws nws rau hauv cov ntawv "qiv" uas muaj nyob hauv Arduino IDE cov npe. Tam sim no peb tuaj yeem yooj yim ua haujlwm nrog cov qauv no.

Txav cov duab kos qhia hauv daim duab qhia rau Arduino hauv txoj kev ua qauv.

Kos duab ntawm kev nyeem lub qhov rooj tus lej xov tooj
Kos duab ntawm kev nyeem lub qhov rooj tus lej xov tooj

Kauj ruam 3

Cov duab kos qhia cov naj npawb tseem ceeb rau intercom, uas yog txuas nrog hauv Circuit Court. Nov yog qhov peb xav tau tam sim no - peb yuav tsum nrhiav qhov lej ntawm qhov tseem ceeb uas peb xav tau ua cov ntawv theej. Txuas Arduino rau koj lub khoos phis tawm. Cia peb pib lub chaw nres nkoj saib xyuas: Cov Cuab Yeej -> Cov chaw nres nkoj nres saib (lossis cov keyboard shortcut Ctrl + Shift + M).

Tam sim no cia txuas tus yuam sij rau Circuit Court. Tus saib xyuas chaw nres nkoj yuav qhia tus lej naj npawb. Cia peb nco qab tus lej no.

Tshawb nrhiav tus naj npawb ntawm qhov tseem ceeb, clone uas peb yuav ua
Tshawb nrhiav tus naj npawb ntawm qhov tseem ceeb, clone uas peb yuav ua

Kauj ruam 4

Tam sim no cia peb rov qab sau cov duab kos kom nws tuaj yeem sau cov ntaub ntawv rau lub cim xeeb tseem ceeb. Cov lus qhia tau qhia nyob hauv zaj lus piv txwv. Cov ncauj lus kom ntxaws qhia nyob hauv kod. Tseem ceeb tshaj plaws, tsis txhob hnov qab teeb tsa tus lej ntawm koj tus lej tseem ceeb hauv key_to_write array, uas koj tau kawm ua ntej me ntsis.

Sketch rau lub cajmeem iButton yuam sij
Sketch rau lub cajmeem iButton yuam sij

Kauj ruam 5

Tso cov duab no rau Arduino. Cia peb qhib cov chaw nres nkoj saib xyuas. Cia txuas tus yuam sij rau hauv Circuit Court, uas yuav yog clone ntawm tus yuam sij thawj. Lub chaw nres nkoj serial yuav saib cov lus ntawm qhov tshwm sim ntawm lub cajmeem.

Kauj ruam 6

1) Yog tias, thaum muab tso ua ke kos duab, ib qho yuam kev tshwm sim [WConstants.h: Tsis muaj cov ntaub ntawv lossis cov ntawv qhia #include "WConstants.h"], tom qab ntawd hauv cov ntaub ntawv "OneWire.cpp" hloov thawj qhov thaiv tom qab cov lus nrog cov hauv qab no:

#Caw tawm rau "OneWire.h"

#leej xeem "Arduino.h"

txawv "C" {

#ncig teb chaws "avr / io.h"

#leej "pins_arduino.h"

}

2) Yog tias thaum muab tso ua ke ntawm cov yuam kev "chav OneWire tsis muaj tus tswv cuab lub npe hu ua read_bytes" lossis cov zoo sib xws, tom qab ntawd nrhiav lwm lub tsev qiv ntawv OneWire, muaj ntau ntawm lawv hauv Is Taws Nem.

Pom zoo: