Cov txheej txheem:

Arduino, Saib Xyuas Qhov Rooj-Qhib Ntawm Gmail: 6 Cov Kauj Ruam
Arduino, Saib Xyuas Qhov Rooj-Qhib Ntawm Gmail: 6 Cov Kauj Ruam

Video: Arduino, Saib Xyuas Qhov Rooj-Qhib Ntawm Gmail: 6 Cov Kauj Ruam

Video: Arduino, Saib Xyuas Qhov Rooj-Qhib Ntawm Gmail: 6 Cov Kauj Ruam
Video: Computer Vision with Python! Resizing Images 2024, Hlis ntuj nqeg
Anonim
Arduino, Saib Xyuas Qhov Rooj-Qhib Ntawm Gmail
Arduino, Saib Xyuas Qhov Rooj-Qhib Ntawm Gmail

Hauv qhov kev qhia no, Kuv yuav qhia koj yuav ua li cas txhawm rau txheeb xyuas lub qhov rooj qhib qhov rooj thiab xa ntawv ceeb toom ntawm Gmail siv Arduino Uno.

Yog tias koj yog tus pib, koj tuaj yeem kawm paub txog wifi thiab sensor hauv Arduino - WiFi thiab Arduino - Qhov Rooj Sensor qhia.

Cia peb pib!

Kev Tshawb Nrhiav Qhov Rooj-Qhib Kev tshwm simMagnetic sensor Kuv siv suav nrog ob ntu: sensor thiab hlau nplaum. Thaum ob ntu nyob sib ze, tus pin tso tawm ntawm lub sensor yog HIGH, txwv tsis pub tus pin tso tawm yog LOW. Ua kom zoo dua ntawm cov yam ntxwv no, Kuv tau teeb tsa ib feem ntawm lub ntsuas cua ntawm lub qhov rooj nplooj thiab lwm qhov ntawm lub qhov rooj. Los ntawm kev txheeb xyuas lub xeev ntawm tus pin tso tawm, peb tuaj yeem tshawb pom thaum lub qhov rooj qhib thiab tom qab ntawv ceeb toom lossis xa ntawv ceeb toom.

Teem Sijhawm

Thaum qhov rooj qhib qhov rooj tshwm sim, ceeb toom xa los ntawm Gmail.

Kauj Ruam 1: Yam Peb Xav Tau

Yam Peb Xav Tau
Yam Peb Xav Tau

1. Arduino UNO lossis Genuino UNO

2. PHPoC Shield rau Arduino

3. Sib nqus Sensor

Kauj ruam 2: Sib dhos

Los ua ke
Los ua ke

1. Tshooj PHPoC Shield ntawm Arduino.

2. Txuas LAN cable rau daim ntaub thaiv rau Ethernet.

3. Pin thaiv ntawm Arduino thiab Sensor.

---- 5v -------- liab pin.

---- A0 ------- tus pin dub.

Kauj Ruam 3: Nruab Qhov Teeb Ntawm Lub Qhov Rooj

Nruab Qhov Teeb Ntawm Lub Qhov Rooj
Nruab Qhov Teeb Ntawm Lub Qhov Rooj

1. Txuas lub sensor ntu, teeb tsa Arduino (suav nrog PHPoC ntaub thaiv npog) rau lub qhov rooj

2. Muab cov hlau nplaum tso rau ntawm nplooj qhov rooj.

3. Hwj chim Arduino

4. Txuas rau Internet ntawm LAN cable lossis USB Wifi Dongle.

Kauj Ruam 4: Rub tawm thiab Nruab Lub Tsev Qiv Ntawv ntawm Arduino

Nruab PHPoC thiab ezButton lub tsev qiv ntawv

Kauj ruam 5: Arduino Code

#suav nrog

#suav nrog PhpocEmail email; ezButton khawm (A0); // tsim khawm khoom uas txuas rau tus pin A0; teeb tsa tsis muaj dab tsi () {Serial.begin (9600); Phpoc.begin (PF_LOG_SPI | PF_LOG_NET | PF_LOG_APP); //Phpoc.beginIP6 (); tsis pom zoo cov kab no yog tias koj yuav siv IPv6 khawm.setDebounceTime (100); // teeb tsa lub sijhawm debounce rau 100 milliseconds} void loop () {button.loop (); // YUAV TSUM hu lub voj () ua haujlwm ua ntej yog (khawm.isPressed ()) {// yog lub qhov rooj qhib … email.setOutgoingServer ("smtp.gmail.com", 587); email.setOutgoingLogin ("Google ID", "Google Password"); email.setFrom ("Gmail chaw nyob", "Tus Neeg Xa Npe"); email.setTo ("Tus tau txais email chaw nyob", "Tus Txais Lub Npe"); email.setSubject ("Qhov rooj tau qhib. [#905]"); // Mail Subject // Mail Contents email.beginMessage (); email.println ("#905"); email.println (""); email.println ("Qhov rooj tau qhib."); email.endMessage (); yog (email.send ()> 0) // Xa Email Serial.println ("Koj li Mail tau xa tiav"); lwm yam Serial.println ("Koj li Mail tsis xa tuaj"); } lwm yog (button.isReleased ()) {// yog lub qhov rooj raug kaw… // Sau cov lej ib yam nkaus}}

Kauj Ruam 6: Ua Ntawv Pov Thawj Ua Haujlwm

  • voj ()
  • teeb ()
  • Serial.begin ()
  • Serial.println ()
  • ncua ()
  • rau lub voj
  • thaum lub voj
  • yog lwm tus
  • String.toInt ()

Pom zoo: