#define BLYNK_TEMPLATE_ID "TMPL6k43NwwG5"
#define BLYNK_TEMPLATE_NAME "7032023"
#define BLYNK_AUTH_TOKEN "M_fOvrOBAx64KeyJlNZKGcEYZ6x3uVS_"
#define BLYNK_PRINT Serial
#include <WiFi.h>
#include <BlynkSimpleEsp32.h>
#include <ESP32Servo.h>
#include <HX711.h>
char auth[] = "M_fOvrOBAx64KeyJlNZKGcEYZ6x3uVS_";
char ssid[] = "Wokwi-GUEST";
char pass[] = "";
#define DATA_PIN 23
#define CLOCK_PIN 19
Servo servo;
HX711 scale;
HX711 hx711;
volatile float units;
void setup()
{
Serial.begin(115200);
Blynk.begin(auth, ssid, pass);
servo.attach(12);
Serial.begin(9600);
hx711.begin(DATA_PIN, CLOCK_PIN);
hx711.set_scale(420);
hx711.tare();
}
void loop()
{
units = hx711.get_units();
Serial.println(units);
delay(200);
Blynk.run();
}
BLYNK_WRITE(V0)
{
servo.write(param.asInt());
}
BLYNK_WRITE(V1)
{
servo.write(param.asInt());
}
BLYNK_WRITE(V2)
{
servo.write(180);
}
BLYNK_WRITE(V3)
{
servo.write(90);
}
BLYNK_WRITE(V4)
{
servo.write(0);
}
ช่างน้ำหนักสายพานกระเป๋า ที่ใช้servo กับ load cell ตัวเชื่อมโดยblynk ในโปรแกรมภาษา c ควรแก้โค้ดอะไรบ้างครับ
#define BLYNK_TEMPLATE_NAME "7032023"
#define BLYNK_AUTH_TOKEN "M_fOvrOBAx64KeyJlNZKGcEYZ6x3uVS_"
#define BLYNK_PRINT Serial
#include <WiFi.h>
#include <BlynkSimpleEsp32.h>
#include <ESP32Servo.h>
#include <HX711.h>
char auth[] = "M_fOvrOBAx64KeyJlNZKGcEYZ6x3uVS_";
char ssid[] = "Wokwi-GUEST";
char pass[] = "";
#define DATA_PIN 23
#define CLOCK_PIN 19
Servo servo;
HX711 scale;
HX711 hx711;
volatile float units;
void setup()
{
Serial.begin(115200);
Blynk.begin(auth, ssid, pass);
servo.attach(12);
Serial.begin(9600);
hx711.begin(DATA_PIN, CLOCK_PIN);
hx711.set_scale(420);
hx711.tare();
}
void loop()
{
units = hx711.get_units();
Serial.println(units);
delay(200);
Blynk.run();
}
BLYNK_WRITE(V0)
{
servo.write(param.asInt());
}
BLYNK_WRITE(V1)
{
servo.write(param.asInt());
}
BLYNK_WRITE(V2)
{
servo.write(180);
}
BLYNK_WRITE(V3)
{
servo.write(90);
}
BLYNK_WRITE(V4)
{
servo.write(0);
}