Arduino Uno, Mavlink and Serial.print()

645 views
Skip to first unread message

André Roy

unread,
Mar 3, 2014, 1:13:00 AM3/3/14
to mav...@googlegroups.com
Hi all,

I'm very new to MAVLink.  I've got the jist of how it works and started experimenting sending/receiving messages with my UNO.  I've found that when including <mavlink.h> it appears to break the use of Serial.print() for debugging.  Is this normal?  Here's my code:

#include <mavlink.h>
#include <serial.h>
void setup()
{
 
  Serial.begin(57600);
  Serial.println("test");
 
}
void loop()
{

}


The code will not print my debugging statements.  I can also get the following example code to compile, so I know the compiler is gaining access to mavlink.h. It still won't print via Serial.

#include <mavlink.h>
#include <serial.h>
void setup()
{
 
  Serial.begin(57600);
  Serial.println("test");
 
  Serial.println(MAVLINK_MAX_PACKET_LEN); 
   mavlink_message_t msg;  
   mavlink_msg_heartbeat_pack(100, 200, &msg, MAV_FIXED_WING, MAV_AUTOPILOT_GENERIC);  
   uint8_t buf[MAVLINK_MAX_PACKET_LEN];  
   uint16_t len = mavlink_msg_to_send_buffer(buf,&msg);

}
void loop()
{
  Serial.println("test");
}


I'm wondering if the ATMEG chip is suffering from a runtime error.  I don't understand why my UNO won't print my debug statements.  Anyone else experience this?

André Roy

unread,
Mar 3, 2014, 9:58:28 PM3/3/14
to mav...@googlegroups.com
yeah, I just confirmed that including mavlink.h from my mavlink library causes a runtime error.  I confirmed by removing all the code and trying to blink an LED.  It works when mavlink isn't included:

#include <mavlink.h>
void setup()
{
  pinMode(A5,OUTPUT);
  digitalWrite(A5,HIGH);
}
void loop()
{
}


So, I have to figure what's going on...  Anyone else ever encounter this?

--
André

Jason Short

unread,
Mar 3, 2014, 10:13:29 PM3/3/14
to mav...@googlegroups.com, mav...@googlegroups.com
Sounds like your out of ram. 
Jason
--
Sie haben diese Nachricht erhalten, da Sie in Google Groups E-Mails von der Gruppe "MAVLink" abonniert haben.
Wenn Sie sich von dieser Gruppe abmelden und keine E-Mails von dieser Gruppe mehr erhalten möchten, senden Sie eine E-Mail an mavlink+u...@googlegroups.com.
Weitere Optionen finden Sie unter https://groups.google.com/groups/opt_out.

André Roy

unread,
Mar 8, 2014, 6:49:26 PM3/8/14
to mav...@googlegroups.com
Hmm, that sounds about right.

Is there a guide somewhere to producing your own headers and using it with Arduino? 
Reply all
Reply to author
Forward
0 new messages