Hello.
I have this issue with sending data from Arduino to PixHawk.
Basically, I have connected both components through Rx and Tx pins. As shown in the figure below.
I also have this arduino code where it can send mavlink messages to the pixhawk with the specific baudrate set.
#include <mavlink.h>
void setup() {
Serial.begin(57600);
}
void loop() {
int data = 132;
uint32_t now = millis();
mavlink_message_t msg;
mavlink_msg_heartbeat_pack(1, 200, &msg, MAV_TYPE_GENERIC, MAV_AUTOPILOT_INVALID, MAV_MODE_PREFLIGHT, 0, MAV_STATE_STANDBY);
uint8_t buf[MAVLINK_MAX_PACKET_LEN];
uint16_t len = mavlink_msg_to_send_buffer(buf, &msg);
Serial.write(buf, len);
delay(1000);
}
My only issue here is how can I manipulate this arduino code so that it can send basic data to the pixhawk like a simple 123 or “Hello”?
I’ve been trying to manipulate it but it doesn’t seem to work. Or is it possible at all? Thanks!