I am trying to make a project where exceeding a certain weight will cause a notification to be sent on my phone. I have an esp8266 and load cell connected to by arduino uno. This is the code I am using:
#include <UnoWiFiDevEd.h>
#include <WiFi.h>
#include <WiFiClient.h>
#include <WiFiServer.h>
#include <WiFiUdp.h>
#include <HX711.h>
String deviceId = "*********"; <------ With the ID
const char logServer = “api.pushingbox.com”;
const char* ssid = “Sarkaar_Wireless”;
const char* password = “************”; <------ With the password
char message;
HX711 loadcell;
void setup()
{
Serial.begin(115200);
//sendNotification(“Hello World from ESP8266!”);
//sendNotification(String message);
{
Serial.println("- connecting to Home Router SID: " + String(ssid));
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED); {
delay(500);
Serial.print(".");
}
Serial.println();
Serial.println("- succesfully connected");
Serial.println("- starting client");
WiFiClient client;
Serial.println("- connecting to pushing server: " + String(logServer));
if (client.connect(logServer, 80)) {
Serial.println("- succesfully connected");
String postStr = “devid=”;
postStr += String(deviceId);
postStr += “&message_parameter=”;
postStr += String(message);
postStr += “\r\n\r\n”;
Serial.println("- sending data…");
client.print(“POST /pushingbox HTTP/1.1\n”);
client.print(“Host: api.pushingbox.com\n”);
client.print(“Connection: close\n”);
client.print(“Content-Type: application/x-www-form-urlencoded\n”);
client.print(“Content-Length: “);
client.print(postStr.length());
client.print(”\n\n”);
client.print(postStr);
}
client.stop();
Serial.println("- stopping the client");
Serial.begin(9600);
pinMode(A1, INPUT);
pinMode(A0, OUTPUT);
//HX711 loadcell;
loadcell.set_scale();
loadcell.tare();
loadcell.get_units(10);
Serial.println(loadcell.get_units(10));
}}
void loop()
{
HX711 loadcell;
const int LOADCELL_DOUT_PIN = 2;
const int LOADCELL_SCK_PIN = 3;
const long LOADCELL_OFFSET = 50682624;
const long LOADCELL_DIVIDER = 5895655;
loadcell.begin(LOADCELL_DOUT_PIN, LOADCELL_SCK_PIN);
loadcell.set_scale(LOADCELL_DIVIDER);
loadcell.set_offset(LOADCELL_OFFSET);
Serial.print("Weight: ");
Serial.println(loadcell.get_units(10), 2);
}
However whenever I run the code it nothing is printed after “connecting to Home Router SID: Sarkaar_Wireless”
What am I doing wrong?