NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

//ESP8266 ile thingspeak'e veri gönderme

#include <SoftwareSerial.h> //Gerekli kütüphaneleri ekledik.
#include <dht11.h>

String agAdi = "*************"; //Ağ adı.
String agSifresi = "********"; //Ağ şifresi.

int rxPin = 10; //ESP8266 TX pinine
int txPin = 11; //ESP8266 RX pinine
int dht11Pin = 2;

String ip = "184.106.153.149"; //Thingspeak ip adresi
float nem, sicaklik;

dht11 DHT11; //DHT 11 nesnesi oluşturduk.

SoftwareSerial esp(rxPin, txPin); //Seri haberleşme pin ayarları

void setup() {

Serial.begin(9600); //Seri port ile haberleşme başlatılıyor.
Serial.println("Bağlantı Başlatılıyor");
esp.begin(9600); //ESP8266 ile seri haberleşme başlatılıyor.
esp.println("AT"); //AT komutu ile modül kontrolünü yapıyoruz.
Serial.println("AT Komutu Yollandı");
while(!esp.find("OK")){ //Modülün hazır olmasını bekliyoruz.
esp.println("AT");
Serial.println("ESP8266 ile Bağlantı Kurulamadı.");
}
Serial.println("OK Cevabı Alındı");
esp.println("AT+CWMODE=1"); //ESP8266 modülünü client olarak ayarlıyoruz.
while(!esp.find("OK")){ //Ayar yapılana kadar bekliyoruz.
esp.println("AT+CWMODE=1");
Serial.println("Modül Türü Ayarlanıyor.");
}
Serial.println("Client olarak ayarlandı");
Serial.println("Ağa Bağlanılıyor...");
esp.println("AT+CWJAP=""+agAdi+"",""+agSifresi+"""); //Ağa bağlanıyoruz.
while(!esp.find("OK")); //Ağa bağlanana kadar bekliyoruz.
Serial.println("Ağa Bağlanıldı.");
delay(1000);
}
void loop() {
esp.println("AT+CIPSTART="TCP",""+ip+"",80"); //Thingspeak'e bağlanıyoruz.

if(esp.find("Error")){ //Bağlantı hatası kontrolü yapıyoruz.
Serial.println("AT+CIPSTART Error");
}

DHT11.read(dht11Pin); //DHT sensörden verileri okuyoruz

sicaklik = (float)DHT11.temperature; //sıcaklık bilgisini aldık
nem = (float)DHT11.humidity; //nem bilgisini aldık

String veri = "GET https://api.thingspeak.com/update?api_key=73N0W23NT8T81AB3"; //Thingspeak komutu. Key kısmına kendi api keyimizi yazıcaz.
veri += "&field1=";
veri += String(sicaklik); //Gönderilecek sıcaklık değişkeni
veri += "&field2=";
veri += String(nem); //Gönderilecek nem değişkeni
veri += "rnrn";
esp.print("AT+CIPSEND="); //ESP'ye gönderilecek veri uzunluğu.
esp.println(veri.length()+2);
delay(2000);
if(esp.find(">")){ //ESP8266 hazır olduğunda içindeki komutlar çalışıyor.
esp.print(veri); //Veriyi gönderiyoruz.
Serial.println(veri);
Serial.println("Veri gonderildi.");
delay(1000);
}
Serial.println("Baglantı Kapatildi.");
esp.println("AT+CIPCLOSE"); //Bağlantıyı kapatıyoruz
delay(1000); //Yeni veri gönderimi için 1 saniye bekliyoruz.
}
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.