Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //2 3 4 5 6 7 8 10 11 12 13
- #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 <LiquidCrystal.h>
- #include "DHT.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 DHTTYPE DHT11
- #define DHTPIN 8
- LiquidCrystal lcd(2, 3, 4, 5, 6, 7);
- DHT dht(DHTPIN, DHTTYPE);
- // RemoteXY configurate
- #pragma pack(push, 1)
- uint8_t 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
- int8_t TempHigh; // =0..100 level position
- int8_t TempLow; // =0..100 level position
- int8_t Hum; // =0..100 level position
- char temp[11]; // string UTF8 end zero
- char hum[11]; // string UTF8 end zero
- // other variable
- uint8_t connect_flag; // =1 if wire connected, else =0
- } RemoteXY;
- #pragma pack(pop)
- /////////////////////////////////////////////
- // END RemoteXY include //
- /////////////////////////////////////////////
- void setup()
- {
- RemoteXY_Init ();
- 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(" ARABS MAKERS ");
- delay(2000);
- lcd.clear();
- lcd.print("Temp: Humidity:");
- }
- void loop()
- {
- RemoteXY_Handler ();
- // TODO you loop code
- // use the RemoteXY structure for data transfer
- // do not call delay()
- lcd.setCursor(0, 1);
- float h = dht.readHumidity();
- float f = dht.readTemperature(true);
- float c = (f - 32) / 1.8;
- dtostrf(c, 0, 1, RemoteXY.temp);
- dtostrf(h, 0, 1, RemoteXY.hum);
- RemoteXY.Hum = h;
- if (isnan(h) || isnan(f))
- {
- lcd.print("ERROR");
- return;
- }
- lcd.print(c);
- lcd.setCursor(7, 1);
- lcd.print(h);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement