I want to controll my drone from esp32 without reciever. I have connect esp32 by UART (RX to TX, TX to RX). And Use this code:
#include <Arduino.h>
#include <HardwareSerial.h>
#include <MAVLink.h>
#define SERIAL_PORT Serial1
void setup() {
Serial.begin(115200);
SERIAL_PORT.begin(115200);
delay(1000);
}
void loop() {
uint16_t throttle_value = 1500;
mavlink_message_t msg;
mavlink_msg_command_long_pack(1, MAV_COMP_ID_AUTOPILOT1, &msg,
MAV_CMD_NAV_TAKEOFF,
0,
0,
0,
0,
0,
0,
throttle_value,
0,
0,
0);
uint8_t buf[MAVLINK_MAX_PACKET_LEN];
uint16_t len = mavlink_msg_to_send_buffer(buf, &msg);
SERIAL_PORT.write(buf, len);
delay(1000);
}
But this code dont start the motors. On the betaflight i have setting that UART3, mavlink. But motors dont start. Si thank you for any help.