Cov txheej txheem:

Tweeting Temp Sensor: 4 Cov Kauj Ruam
Tweeting Temp Sensor: 4 Cov Kauj Ruam

Video: Tweeting Temp Sensor: 4 Cov Kauj Ruam

Video: Tweeting Temp Sensor: 4 Cov Kauj Ruam
Video: How to use W1209 Temperature relay controller and program the thermostat 2024, Kaum ib hlis
Anonim
Tweeting Temp Sensor
Tweeting Temp Sensor

Ua koj tus kheej Tweeting Kub Sensor uas tuaj yeem ua haujlwm nyob txhua qhov chaw nrog WiFi.

Kauj Ruam 1: Kauj Ruam 1: Tsim Koj Lub Ntsuas Kub

Kauj Ruam 1: Tsim Koj Qhov Kub Kub Sensor
Kauj Ruam 1: Tsim Koj Qhov Kub Kub Sensor

Yam Yuav Tsum Tau:

1 - Photon

1 - dht22 Kub Sensor

1 - Daim ntawv qhia zaub mov

1 - 10K Resistor

5 - Cov xov hlau

1 - USB rau Mini -USB Cord

1 - Ntsa Plug

Teeb koj lub photon zoo li qhia hauv Fritzing Diagram saum toj no:)

Kauj Ruam 2: Kauj Ruam 2: Tsim Twitter Account thiab Teeb Arduino-tweet.appspot.com

Tsim twitter koj xav tweet los ntawm Photon. Tom qab tsim twitter mus rau arduino-tweet.appspot.com thiab muab tso rau hauv koj tus lej cim twitter. Lub vev xaib no yuav muab tus cim tshiab rau koj uas koj yuav muab tso rau hauv cov lej hauv cov kauj ruam tom ntej. Qhov no tso cai rau koj los tweet los ntawm photon.

Kauj Ruam 3: Kauj Ruam 3: Nthuav Koj Cov Cai ntawm Build.particle.io (Code Hauv Qab thiab Hauv Duab)

Kauj Ruam 3: Thawb Koj Cov Cai ntawm Build.particle.io (Cov Cai Hauv Qab thiab Hauv Duab)
Kauj Ruam 3: Thawb Koj Cov Cai ntawm Build.particle.io (Cov Cai Hauv Qab thiab Hauv Duab)

// Cov lus #suav nrog no tau txiav txim siab ntxiv los ntawm Particle IDE.

#suav nrog

// OAuth Key #define TOKEN "825469186306617344-sDdIZblaYgQhyNLGgIuk1p4a5yuFytD"

// Twitter Proxy #define LIB_DOMAIN "arduino-tweet.appspot.com"

TCPClient tus neeg siv khoom; #define DHTPIN 0 // dab tsi tus pin peb txuas nrog #define DHTTYPE DHT22 // uas lub sensor peb siv: DHT 22

DHT dht (DHTPIN, DHTTYPE);

ob chav curr_hum; // tam sim no hum ob npaug curr_temp; // tam sim no ntsuas tsis muaj nuj nqis checkHum () {curr_hum = dht.getHumidity (); }

tsis muaj dab tsi checkTemp () {curr_temp = dht.getTempFarenheit (); } void teeb () {pinMode (DHTPIN, INPUT); checkTemp (); char msg = "Nyob zoo!" + Txoj hlua (curr_temp); // msg = "Nyob zoo!" + char (curr_temp); ncua (1000); client.connect (LIB_DOMAIN, 80); client.println ("POST /hloov tshiab HTTP /1.0"); client.println ("Host:" LIB_DOMAIN); client.print ("Cov ntsiab lus-Ntev:"); client.println (tawv ncauj (msg)+tawv ncauj (TOKEN) +14); client.println (); cov. client.print ("token ="); cov. client.print (TOKEN); client.print ("& xwm txheej ="); client.println (msg); } /*void tweetOut (String message) {// char msg = message.toCharArray (); ncua (1000);

client.connect (LIB_DOMAIN, 80); client.println ("POST /hloov tshiab HTTP /1.0"); client.println ("Host:" LIB_DOMAIN); client.print ("Cov ntsiab lus-Ntev:"); client.println (tawv ncauj (msg)+tawv ncauj (TOKEN) +14); client.println (); cov. client.print ("token ="); cov. client.print (TOKEN); client.print ("& xwm txheej ="); client.println (msg); } * / void loop () { / * checkHum (); // xyuas cov av noo. Teeb tsa cov kev hloov pauv hauv zos curr_hum thiab curr_hum str checkTemp (); char msg = "Nyob zoo sawv ntxov! Qhov ntsuas kub tam sim no yog:"+Char (curr_temp)+". Cov av noo tam sim no yog:"+Char (curr_hum)+"."); ncua (1000); client.connect (LIB_DOMAIN, 80); client.println ("POST /hloov tshiab HTTP /1.0"); client.println ("Host:" LIB_DOMAIN); client.print ("Cov ntsiab lus-Ntev:"); client.println (tawv ncauj (msg)+tawv ncauj (TOKEN) +14); client.println (); cov. client.print ("token ="); cov. client.print (TOKEN); client.print ("& xwm txheej ="); client.println (msg); ncua (60000); */}

Kauj Ruam 4: Kauj Ruam 4: Tsim Kev Ruaj Ntseg thiab Tau Txais Tweeting

Tsim lub thaiv, ntsaws rau hauv phab ntsa uas koj xav tau qhov kub thiab txias thiab thawb cov cai los ntawm build.particle.io!

Pom zoo: