มันผิดตรงไหนคับ
ว่าจะสั่งการด้วย blynk แต่พอสั่งแล้วมันไม่เกิดผลอะไรเลย
พอกดเเล้วมันไม่ขึ้นคะเเนนครับมีวิธีเเก้รึมีโค้ดบางไหมคับ
#define I2C_SDA_PIN D2 // D2
#define I2C_SCL_PIN D1
int count = 0;
int q1 = 0;
byte add = 0;
void setup() {
Wire.begin(SCL,D1);
Wire.begin(SDA,D2);
Serial.begin(115200);
WiFiManager wifiManager;
wifiManager.autoConnect("AutoConnectAP");
Blynk.config(auth);
Serial.println("connected...yeey 🙂");
Serial.println("V Setup");
}
BLYNK_WRITE(V1)
{
if (param.asInt() == HIGH)
{
q1++;
if (q1 >10 )
{
q1=0;
}
count = q1;
add = 0x21;
disp();
delay(100);
}
}
void disp()
{
count = q1;
add = 0x21;
dispNum();
}
void dispNum() {
if (count == 0) {
Wire.beginTransmission(add); // Begin I2C Write PCF8575 = 0100,000+(0:W)
Wire.write(0x3F); // Right Digit Display "0" : 0 0 1 1 1 1 1 1
Wire.write(0x3F); // Left Digit Display "1" : 0 0 1 1 0 0 0 0
Wire.endTransmission(); // End I2C
}
if (count == 1) {
Wire.beginTransmission(add); // Begin I2C Write PCF8575 = 0100,000+(0:W)
Wire.write(0x06); // Right Digit Display "0" : 0 0 1 1 1 1 1 1
Wire.write(0x3F); // Left Digit Display "1" : 0 0 1 1 0 0 0 0
Wire.endTransmission(); // End I2C
}
if (count == 2) {
Wire.beginTransmission(add); // Begin I2C Write PCF8575 = 0100,000+(0:W)
Wire.write(0x5B); // Right Digit Display "0" : 0 0 1 1 1 1 1 1
Wire.write(0x3F); // Left Digit Display "1" : 0 0 1 1 0 0 0 0
Wire.endTransmission(); // End I2C
}
if (count == 3) {
Wire.beginTransmission(add); // Begin I2C Write PCF8575 = 0100,000+(0:W)
Wire.write(0x4F); // Right Digit Display "0" : 0 0 1 1 1 1 1 1
Wire.write(0x3F); // Left Digit Display "1" : 0 0 1 1 0 0 0 0
Wire.endTransmission(); // End I2C
}
if (count == 4) {
Wire.beginTransmission(add); // Begin I2C Write PCF8575 = 0100,000+(0:W)
Wire.write(0x66); // Right Digit Display "0" : 0 0 1 1 1 1 1 1
Wire.write(0x3F); // Left Digit Display "1" : 0 0 1 1 0 0 0 0
Wire.endTransmission(); // End I2C
}
if (count == 5) {
Wire.beginTransmission(add); // Begin I2C Write PCF8575 = 0100,000+(0:W)
Wire.write(0x6D); // Right Digit Display "0" : 0 0 1 1 1 1 1 1
Wire.write(0x3F); // Left Digit Display "1" : 0 0 1 1 0 0 0 0
Wire.endTransmission(); // End I2C
}
if (count == 6) {
Wire.beginTransmission(add); // Begin I2C Write PCF8575 = 0100,000+(0:W)
Wire.write(0x7D); // Right Digit Display "0" : 0 0 1 1 1 1 1 1
Wire.write(0x3F); // Left Digit Display "1" : 0 0 1 1 0 0 0 0
Wire.endTransmission(); // End I2C
}
if (count == 7) {
Wire.beginTransmission(add); // Begin I2C Write PCF8575 = 0100,000+(0:W)
Wire.write(0x07); // Right Digit Display "0" : 0 0 1 1 1 1 1 1
Wire.write(0x3F); // Left Digit Display "1" : 0 0 1 1 0 0 0 0
Wire.endTransmission(); // End I2C
}
if (count == 😎 {
Wire.beginTransmission(add); // Begin I2C Write PCF8575 = 0100,000+(0:W)
Wire.write(0x7F); // Right Digit Display "0" : 0 0 1 1 1 1 1 1
Wire.write(0x3F); // Left Digit Display "1" : 0 0 1 1 0 0 0 0
Wire.endTransmission(); // End I2C
}
if (count == 9) {
Wire.beginTransmission(add); // Begin I2C Write PCF8575 = 0100,000+(0:W)
Wire.write(0x6F); // Right Digit Display "0" : 0 0 1 1 1 1 1 1
Wire.write(0x3F); // Left Digit Display "1" : 0 0 1 1 0 0 0 0
Wire.endTransmission(); // End I2C
}
if (count == 10) {
Wire.beginTransmission(add); // Begin I2C Write PCF8575 = 0100,000+(0:W)
Wire.write(0x3F); // Right Digit Display "0" : 0 0 1 1 1 1 1 1
Wire.write(0x06); // Left Digit Display "1" : 0 0 1 1 0 0 0 0
Wire.endTransmission(); // End I2C
}
}
void loop() {
Blynk.run();
}