0

I´m newbie with arduino. I want to send commands from arduino uno to apm 2.6. I connect these boards like telemetry of apm to RX, TX, GND of arduino and the power now is from usb for both boards. Here is my code that has to arm apm but it doesn´t work.

#include <string.h>
#include <Arduino.h>
#include <mavlink.h>
#include <SoftwareSerial.h>
SoftwareSerial SerialMAV =  SoftwareSerial(16,17);
void setup() {
    Serial.begin(57600);
    pinMode(16, INPUT);
    pinMode(17, OUTPUT);
    SerialMAV.begin(57600);
    Command_long_ARM();
}

void loop() {
}

void Command_long_ARM(){

  mavlink_message_t msg; 
  uint8_t buf[MAVLINK_MAX_PACKET_LEN];
  uint16_t len = mavlink_msg_to_send_buffer(buf, &msg);


  mavlink_msg_command_long_pack(255, 190, &msg, 1, 1, 400, 1, 1.0, 0, 0, 0, 0, 0, 0);
  uint16_t len = mavlink_msg_to_send_buffer(buf, &msg);
  SerialMAV.write(buf, len);

}

I think that I made a mistake in parameters of mavlink_msg_command_long_pack() but I don't understand where I have to take these correct parameters. Can you please explain me? Is it correct to search them in Mission Planner -> config/tuning -> full parameter tree -> sysid ?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.