#include <WiFi.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <HTTPClient.h>
const char buzzer = 33, V = 27, I = 26, P = 25;
LiquidCrystal_I2C LCD = LiquidCrystal_I2C(0x27, 16, 2);
String url = "https://example.com";
void spinner() {
static int8_t counter = 0;
const char* glyphs = "\xa1\xa5\xdb";
LCD.setCursor(15, 1);
LCD.print(glyphs[counter++]);
if (counter == strlen(glyphs)) {
counter = 0;
}
}
void send_data(){
}
void setup() {
Serial.begin(115200);
pinMode(buzzer, OUTPUT);
pinMode(V, INPUT);
pinMode(I, INPUT);
pinMode(P, INPUT);
LCD.init();
LCD.backlight();
LCD.setCursor(0, 0);
LCD.print("Connecting to ");
LCD.setCursor(0, 1);
LCD.print("WiFi ");
WiFi.begin("Wokwi-GUEST", "", 6);
while (WiFi.status() != WL_CONNECTED) {
delay(250);
spinner();
}
Serial.println("");
Serial.println("WiFi connected");
Serial.print("IP address: ");
Serial.println(WiFi.localIP());
HTTPClient http;
http.begin(url);
int httpResponseCode = http.GET();
if (httpResponseCode > 0) {
Serial.print("HTTP ");
Serial.println(httpResponseCode);
String payload = http.getString();
Serial.println();
Serial.println(payload);
}
else {
Serial.print("Error code: ");
Serial.println(httpResponseCode);
Serial.println(":-(");
}
}
void loop() {
delay(10);
}