diff --git a/en/mavgen_python/index.md b/en/mavgen_python/index.md index 22f2cd4a2..94e32490a 100644 --- a/en/mavgen_python/index.md +++ b/en/mavgen_python/index.md @@ -158,8 +158,11 @@ the_connection = mavutil.mavlink_connection('udpin:localhost:14540') # Wait for the first heartbeat # This sets the system and component ID of remote system for the link -the_connection.wait_heartbeat() -print("Heartbeat from system (system %u component %u)" % (the_connection.target_system, the_connection.target_component)) +hb = the_connection.wait_heartbeat() +if hb is not None: + print("Heartbeat from system (system %u component %u)" % (the_connection.target_system, the_connection.target_component)) +else: + print("No heartbeat received") # Once connected, use 'the_connection' to get and send messages ```