Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "LiquidCrystal.h" // تضمين مكتبة الأكواد الخاصة بالشاشة
- #include "DHT.h" // تضمين مكتبة الحساس
- #define DHTTYPE DHT11 //تعرف نوع الحساس
- #define DHTPIN 12 //تعريف رقم طرف توصيل الحساس
- LiquidCrystal lcd(2, 3, 4, 5, 6, 7); //LCD connection pins
- DHT dht(DHTPIN, DHTTYPE);
- #define REMOTEXY_MODE__ETHERNET_LIB
- #include <Ethernet.h>
- /* Ethernet shield used pins: 10(SS) */
- #include <SPI.h>
- /* SPI interface used pins: 11(MOSI), 12(MISO), 13(SCK) */
- #include <RemoteXY.h>
- #include<IPAddress.h>
- // RemoteXY connection settings
- #define REMOTEXY_ETHERNET_MAC "C2:B6:58:85:CD:64"
- #define REMOTEXY_SERVER_PORT 6377
- #define REMOTEXY_ACCESS_PASSWORD "123456789"
- //#define RemoteXY RM
- //IPAddress ip(192, 168, 1, 177);
- //IPAddress myDns(192, 168, 1, 1);
- //IPAddress gateway(192, 168, 1, 1);
- //IPAddress subnet(255, 255, 0, 0);
- // RemoteXY configurate
- #pragma pack(push, 1)
- int RemoteXY_CONF[] = // 98 bytes
- { 255, 0, 0, 25, 0, 91, 0, 16, 167, 1, 66, 193, 30, 17, 25, 7, 34, 26, 66, 129,
- 5, 17, 25, 7, 191, 26, 66, 193, 15, 56, 30, 7, 2, 26, 67, 4, 20, 28, 20, 5,
- 2, 26, 11, 67, 4, 20, 66, 20, 5, 2, 26, 11, 129, 0, 6, 8, 18, 6, 24, 84,
- 101, 109, 112, 116, 101, 114, 58, 0, 129, 0, 16, 49, 18, 6, 24, 72, 117, 109, 105, 100,
- 105, 116, 121, 58, 0, 129, 0, 25, 34, 9, 6, 8, 48, 32, 67, 217, 146, 0
- };
- // this structure defines all the variables and events of your control interface
- struct {
- // output variables
- int TempHigh; // =0..100 level position
- int TempLow; // =0..100 level position
- int Hum; // =0..100 level position
- char f[12]; // string UTF8 end zero
- char h[12]; // string UTF8 end zero
- // other variable
- int connect_flag; // =1 if wire connected, else =0
- } RemoteXY;
- #pragma pack(pop)
- //IPAddress ip(192.168.247.1);
- void setup() //دالة الإعداد وتنفذ مرة واحدة فقط فى بداية البرنامج
- { //كل الأوامر التالية بين القوسين ضمن هذه الدالة
- //أمر لبدء تشغيل الحساس
- lcd.begin(16, 2); //أمر لبدء تشغيل الشاشة
- dht.begin(); //أمر لبدء تشغيل الحساس
- lcd.clear(); //أمر مسح الشاشة
- lcd.print("Temp & Humidity"); //أمر طباعة رسالة تعريفية للدائرة
- lcd.setCursor(0, 1);
- lcd.print(" Measurement ");
- delay(2000); //أمر إنتظار ثانيتين
- lcd.clear();
- lcd.print(" Waad Ghos ");
- lcd.setCursor(0, 1);
- lcd.print(" 3820046 ");
- delay(2000);
- lcd.clear();
- lcd.print("Temp: Humidity:");
- // RemoteXY_Init ();
- }
- void loop() //دالة التكرار وتنفذ باستمرار طالما يوجد تغذية كهرباء للأردوينو
- {
- lcd.clear();
- delay(500);
- lcd.setCursor(0, 1); //وضع المؤشر فى اول عمود والصف الثانى
- float h = dht.readHumidity(); // قراءة نسبة الرطوبة
- float f = dht.readTemperature(true); //قراءة قيمة درجة الحرارة بالفهرنهايت من الحساس
- float c = (f - 32) / 1.8; //تحويل من فهرنهايت إلى سيليزيوس
- if (isnan(h) || isnan(f))
- {
- lcd.print("ERROR");
- return;
- }
- lcd.print(c); // طباعة درجة الحرارة
- lcd.setCursor(7, 1);
- lcd.print(h); // طباعة الرطوبة
- RemoteXY_Handler ();
- float hum = dht.readHumidity(); // قراءة نسبة الرطوبة
- float temp = dht.readTemperature(); //قراءة قيمة درجة الحرارة بالفهرنهايت من الحساس
- // float c = (f - 32) / 1.8; //تحويل من فهرنهايت إلى سيليزيوس
- if (isnan(h) || isnan(f))
- dtostrf(f, 0, 1, RemoteXY.f);
- dtostrf(h, 0, 1, RemoteXY.h);
- delay(2000);
- }
Advertisement
Add Comment
Please, Sign In to add comment