Robotics Institute 

University of Michigan, Ann Arbor

© 2017 by Bruce Personal Website. 

Updated on 8/21/2017

Mavlinked Code

November 2, 2015

// <date>2015-11-2</date>
*/

#include <FastSerial.h>
#include "..libraries\mavlink\include\mavlink.h"        // Mavlink interface
FastSerialPort0(Serial);
#define dir 13 //Set pin 13 as Direction pin. Not important, only use to set the motor direction. 
#define en 9 // Set pin 9 as Step pin
#define stepps 12 // Set pin 12 as Step pin
#define homingP 2 // EE-SX671 PIN for homing
#define RadarIN A0 // Radar input pin Anolog
#define safety 3 // Radar input pin Anolog
    int steps = 0;
 /* The default UART header for your MCU */ 
    int sysid = 20;                   ///< ID 20 for this airplane
    int compid = MAV_COMP_ID_IMU;    

///< The component sending the message is the IMU, it could be also a Linux process
    int type = MAV_TYPE_QUADROTOR;   ///< This system is an airplane / fixed wing
 
// Define the system type, in this case an airplane
    uint8_t system_type = MAV_TYPE_FIXED_WING;
    uint8_t autopilot_type = MAV_AUTOPILOT_GENERIC;
    uint8_t system_mode = MAV_MODE_PREFLIGHT; ///< Booting up
    uint32_t custom_mode = 0;                 ///< Custom mode, can be defined by user/adopter
    uint8_t system_state = MAV_STATE_STANDBY; ///< System ready for flight
    uint8_t target_sys = 2;
    uint8_t target_com = 2;
    uint8_t c;
    // Initialize the required buffers
    mavlink_message_t msg;
    mavlink_status_t status;
    uint8_t buf[MAVLINK_MAX_PACKET_LEN];

Please reload