That is my code :
/*
* HT1 driver
* ESP32 devkitc v4
* https://www.innowtech.com/
*/
HardwareSerial mySerial2(2);
// UART0
#define RXD0 3
#define TXD0 1
// UART2
#define RXD2 16
#define TXD2 17
#define BR 115200
// Serial
byte cmd[]={0x23, 0x30, 0x4d, 0x44, 0x30, 0x34, 0x35, 0x30, 0x0D}; // 23 30 4d 44 30 34 35 30 #0MD0450\r
byte rst[]={0x23, 0x30, 0x52, 0x45, 0x53, 0x45, 0x54, 0x0D}; // 23 30 52 45 53 45 54 #0RESET\r
byte conf[]={0x23, 0x30, 0x43, 0x4f, 0x4e, 0x46, 0x49, 0x52, 0x4d, 0x0D}; // 23 30 43 4f 4e 46 49 52 4d #0CONFIRM\r
byte led[]={0x23, 0x30, 0x4c, 0x45, 0x44, 0x31, 0x0D}; // 23 30 4c 45 44 45 44 31 #0LED1\r
byte cmd_1[]={0x23, 0x32, 0x35, 0x34, 0x4d, 0x44, 0x30, 0x34, 0x35, 0x30, 0x0D}; // 23 30 4d 44 30 34 35 30 #254MD0450\r
byte rst_1[]={0x23, 0x32, 0x35, 0x34, 0x52, 0x45, 0x53, 0x45, 0x54, 0x0D}; // 23 30 52 45 53 45 54
byte conf_1[]={0x23, 0x32, 0x35, 0x34, 0x43, 0x4f, 0x4e, 0x46, 0x49, 0x52, 0x4d, 0x0D}; // 23 32 35 34 43 4f 4e 46 49 52 4d
byte led_1[]={0x23, 0x32, 0x35, 0x34, 0x4c, 0x45, 0x44, 0x31, 0x0D}; // 23 32 35 34 4c 45 44 31
// Init
int cpt = 1;
void setup()
{
// UART
Serial.begin(115200);
//Serial.begin(115200, SERIAL_8N1, RXD0, TXD0); // set-up UART on GPIO 1 & 3 with 115 200 baud rate
mySerial2.begin(BR, SERIAL_8N1, RXD2, TXD2);
// BEGIN
Serial.println("**** Program start****");
Serial.printf("UART 2 : TX -> %u / RX -> %u / baud rate -> %u", TXD2, RXD2, BR);
Serial.println();
// RESET
/*mySerial2.print("#0RESET\r");
delay(50);
mySerial2.print("#0CONFIRM\r");
delay(1500);
delay(950);
*/
/*mySerial2.write(rst,8);
delay(50);
mySerial2.write(conf,10);
delay(1250);*/
}
void loop()
{
// 3x loop -> 3x cmd
if(cpt < 4)
{
TestServo();
cpt++;
}
}
void TestServo()
{
mySerial2.print("#254MD0450\r");
delay(1000);
/*
mySerial2.write(cmd,9);
delay(1000);
*/
}
I have powered the ESP32 at firt and before the servo power ON, so my ESP have probably sent messages before the end of startup routine. I try again the factory reset without TX and RX plugs to ESP32 and now I can see the red light at the end of factory reset but the blinking red light at the end of startup routine keep staying…