Mundarija:

Tweeting harorat sensori: 4 qadam
Tweeting harorat sensori: 4 qadam

Video: Tweeting harorat sensori: 4 qadam

Video: Tweeting harorat sensori: 4 qadam
Video: ЗАПРЕЩЁННЫЕ ТОВАРЫ с ALIEXPRESS 2023 ШТРАФ и ТЮРЬМА ЛЕГКО! 2024, Noyabr
Anonim
Tweeting harorat sensori
Tweeting harorat sensori

Wi -Fi yordamida istalgan joyda ishlashi mumkin bo'lgan o'zingizning Tweeting harorat sensori yarating.

1 -qadam: 1 -qadam: Harorat sensori yarating

1 -qadam: Harorat sensori yarating
1 -qadam: Harorat sensori yarating

Kerakli qismlar:

1 - foton

1 - dht22 harorat sensori

1 - non paneli

1 - 10K qarshilik

5 - simlar

1 - USB -dan Mini -USB kabeli

1 - devor vilkasi

Fotoningizni yuqoridagi chizish diagrammasida ko'rsatilganidek o'rnating:)

2-qadam: 2-qadam: Twitter hisobini yarating va Arduino-tweet.appspot.com-ni o'rnating

Photon -dan tvit yozmoqchi bo'lgan twitter -ni yarating. Tvitterni yaratgandan so'ng, arduino-tweet.appspot.com saytiga o'ting va twitter belgisini qo'ying. Bu sayt sizga yangi belgini beradi, uni keyingi bosqichda kodga kiritasiz. Bu sizga fotondan tvit yozish imkonini beradi.

3 -qadam: 3 -qadam: O'z kodingizni Build.particle.io -ga kiriting (Kod quyida va rasmda)

3 -qadam: Build.particle.io -da o'z kodingizni kiriting (Quyidagi va rasmdagi kod)
3 -qadam: Build.particle.io -da o'z kodingizni kiriting (Quyidagi va rasmdagi kod)

// Bu #include bayonoti Particle IDE tomonidan avtomatik ravishda qo'shilgan.

#qo'shing

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

// Twitter proksi-serveri #debine LIB_DOMAIN "arduino-tweet.appspot.com"

TCPClient mijozi; #define DHTPIN 0 // biz qaysi pinga ulanganmiz #deft DHTTYPE DHT22 // biz qaysi sensordan foydalanamiz: DHT 22

DHT dht (DHTPIN, DHTTYPE);

er -xotin; // joriy hum juftlik Curr_temp; // joriy temp void checkHum () {Curr_hum = dht.getHumidity (); }

bekor checkTemp () {curr_temp = dht.getTempFarenheit (); } void setup () {pinMode (DHTPIN, INPUT); checkTemp (); char msg = "Salom!" + String (Curr_temp); // msg = "Salom!" + char (Curr_temp); kechikish (1000); client.connect (LIB_DOMAIN, 80); client.println ("POST /HTTP /1.0 yangilash"); client.println ("Xost:" LIB_DOMAIN); client.print ("Content-Length:"); client.println (strlen (msg)+strlen (TOKEN) +14); mijoz.println (); client.print ("token ="); client.print (TOKEN); client.print ("& status ="); client.println (msg); } /*void tweetOut (String xabar) {// char msg = message.toCharArray (); kechikish (1000);

client.connect (LIB_DOMAIN, 80); client.println ("POST /HTTP /1.0 yangilash"); client.println ("Xost:" LIB_DOMAIN); client.print ("Content-Length:"); client.println (strlen (msg)+strlen (TOKEN) +14); mijoz.println (); client.print ("token ="); client.print (TOKEN); client.print ("& status ="); client.println (msg); } * / void loop () { / * checkHum (); // namlikni tekshiring. Curr_hum va Curr_hum str checkTemp () mahalliy o'zgaruvchilarini o'rnatadi; char msg = "Xayrli kun! Hozirgi harorat:"+Char (Curr_temp)+". Hozirgi namlik:"+Char (Curr_hum)+"."); kechikish (1000); client.connect (LIB_DOMAIN, 80); client.println ("POST /HTTP /1.0 yangilash"); client.println ("Xost:" LIB_DOMAIN); client.print ("Content-Length:"); client.println (strlen (msg)+strlen (TOKEN) +14); mijoz.println (); client.print ("token ="); client.print (TOKEN); client.print ("& status ="); client.println (msg); kechikish (60000); */}

4 -qadam: 4 -qadam: Korpus yarating va tvit qiling

Devorni qurib, harorat va namlikni xohlagan devorga ulang va build.particle.io -dan kodni kiriting!

Tavsiya: