Deepseek
Deepseek
h>
#include <Adafruit_INA219.h>
#include <DHT.h>
#include <WiFi.h>
#include <HTTPClient.h>
// Konfigurasi WiFi
// Konfigurasi ThingSpeak
// Konfigurasi DHT22
float shuntVoltage_1 = 0;
float busVoltage_1 = 0;
float current_1 = 0;
float power_1 = 0;
float shuntVoltage_2 = 0;
float busVoltage_2 = 0;
float current_2 = 0;
float power_2 = 0;
float temperature = 0;
float humidity = 0;
void setup() {
Serial.begin(115200);
delay(10);
WiFi.begin(ssid, password);
delay(500);
Serial.print(".");
Serial.println("WiFi connected");
while (1);
if (!ina219_2.begin()) {
while (1);
dht.begin();
void loop() {
shuntVoltage_1 = ina219_1.getShuntVoltage_mV();
busVoltage_1 = ina219_1.getBusVoltage_V();
current_1 = ina219_1.getCurrent_mA();
power_1 = ina219_1.getPower_mW();
shuntVoltage_2 = ina219_2.getShuntVoltage_mV();
busVoltage_2 = ina219_2.getBusVoltage_V();
current_2 = ina219_2.getCurrent_mA();
power_2 = ina219_2.getPower_mW();
// Baca data dari DHT22
humidity = dht.readHumidity();
temperature = dht.readTemperature();
if (isnan(humidity) || isnan(temperature)) {
return;
if (WiFi.status() == WL_CONNECTED) {
HTTPClient http;
"&field1=" + String(busVoltage_1) +
"&field2=" + String(current_1) +
"&field3=" + String(power_1) +
"&field4=" + String(busVoltage_2) +
"&field5=" + String(current_2) +
"&field6=" + String(power_2) +
"&field7=" + String(temperature) +
"&field8=" + String(humidity);
http.begin(url);
if (httpResponseCode > 0) {
Serial.println(httpResponseCode);
Serial.println(response);
} else {
Serial.println(httpResponseCode);
http.end();
} else {
Serial.println("WiFi terputus");