#include const int LOADCELL_DOUT_PIN = 32; const int LOADCELL_SCK_PIN = 33; HX711 scale; #include #include #include WiFiClient client; #define ONE_WIRE_BUS 4 OneWire oneWire(ONE_WIRE_BUS); DallasTemperature DS18B20(&oneWire); void setup() { Serial.begin(115200); delay(10); scale.begin(LOADCELL_DOUT_PIN, LOADCELL_SCK_PIN); DS18B20.begin(); WiFi.mode(WIFI_STA); connectWiFi(); } void loop() { if(WiFi.status() != WL_CONNECTED){ connectWiFi(); } client.connect("api.thingspeak.com", 80); DS18B20.requestTemperatures(); delay(1000); float temperature = DS18B20.getTempCByIndex(0); //Serial.println(temperature); Serial.println(scale.read()); float pressure = (scale.read()); pressure = pressure - 2450000; // add offset pressure = pressure * (-0.000018); // add scale factor delay(1000); String url = "/update?api_key="; // Build string for posting url += "add api key"; // Your api key url += "&field1="; url += String(pressure); url += "&field2="; url += String(temperature); // client.print(String("GET ") + url + " HTTP/1.1\r\n" + "Host: " + "api.thingspeak.com" + "\r\n" + "Connection: close\r\n\r\n"); // delay(60000); // send data every minute } void connectWiFi(){ while (WiFi.status() != WL_CONNECTED) { WiFi.begin("ssid","password"); // WiFi login delay(2500); } }