ถ้าผมต้องการ hold การทำงาน ของ relay จากการกด push button widget ใน แอพ blynk (กดติดปล่อยดับ) สามารถทำยังได้บ้างครับ อยากให้ ทริก 1 จาก push button พอปุ่มลงเป็น 0 แล้ว output ยังคงทำงานอยู่
วางโค้ตที่ใช้ด้วยครับ
/*************************************************************
Download latest Blynk library here:
https://github.com/blynkkk/blynk-library/releases/latest
Blynk is a platform with iOS and Android apps to control
Arduino, Raspberry Pi and the likes over the Internet.
You can easily build graphic interfaces for all your
projects by simply dragging and dropping widgets.
Downloads, docs, tutorials: http://www.blynk.cc
Sketch generator: http://examples.blynk.cc
Blynk community: http://community.blynk.cc
Social networks: http://www.fb.com/blynkapp
http://twitter.com/blynk_app
Blynk library is licensed under MIT license
This example code is in public domain.
*************************************************************
This example shows how to use ESP32 BLE
to connect your project to Blynk.
Warning: Bluetooth support is in beta!
*************************************************************/
/* Comment this out to disable prints and save space */
#define BLYNK_PRINT Serial
#define BLYNK_USE_DIRECT_CONNECT
#include <BlynkSimpleEsp32_BLE.h>
#include <BLEDevice.h>
#include <BLEServer.h>
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "c1RiEgLFtW11IccEoIWQBhjac7vWgu8P";
int relay1 = 23;
int relay2 = 22;
int relay3 = 21;
int relay4 = 3;
void setup()
{
// Debug console
Serial.begin(9600);
Serial.println("Waiting for connections...");
Blynk.setDeviceName("AIRLIFT");
Blynk.begin(auth);
pinMode(relay1, OUTPUT);
pinMode(relay2, OUTPUT);
pinMode(relay3, OUTPUT);
pinMode(relay4, OUTPUT);
}
BLYNK_WRITE(V1){
if (param.asInt () == 1 ){
digitalWrite(relay1, HIGH);
digitalWrite(relay3, HIGH);
delay(500);
digitalWrite(relay1, LOW);
digitalWrite(relay3, LOW);
}
}
void loop()
{
Blynk.run();
}
**strong text**
รบกวนชี้แนะด้วยครับ