#include <CoreX.h>
#include "Connection.h"
CoreXTimer timer;
// Ubah nilai auth_token dan device Anda
const char* AUTH_TOKEN = "UjpXb4j9BVGSlJ3";
const char* DEVICE_ID = "6LituGwfQ";
// Ubah nilai berikut sesuai jaringan Anda
const char ssid[] = "Wokwi-GUEST";
const char pass[] = "";
int pot;
void setup() {
pinMode(32,INPUT);
Serial.begin(115200);
WiFi.begin(ssid, pass);
corex.begin(net);
timer.setInterval(2000, send);
setupCoreX();
}
void loop() {
timer.run();
delay(10);
if (!corex.connected()) {
setupCoreX();
}
}
void send (){
pot = analogRead(32);
corex.send("potensiometer" , pot);
Serial.println(pot);
}