# How to use the topic orb\_advertise\_multi function

**URL:** <https://discuss.px4.io/t/how-to-use-the-topic-orb-advertise-multi-function/2968>\
**Category:** Uncategorized\
**Created:** [April 7, 2017, 9:04am UTC](https://discuss.px4.io/t/how-to-use-the-topic-orb-advertise-multi-function/2968 "2017-04-07T09:04:41Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![garlinplus](https://discuss.px4.io/user_avatar/discuss.px4.io/garlinplus/32/271_2.png) [@garlinplus](https://discuss.px4.io/u/garlinplus)\
**Post date:** [April 7, 2017, 9:04am UTC](https://discuss.px4.io/t/how-to-use-the-topic-orb-advertise-multi-function/2968/1 "2017-04-07T09:04:41Z")

</div>

I advertise a topic with two instant as followed:  
int idx1,idx2;

pub1 = orb\_advertise\_multi(ORB\_ID(xxx\_status),&xxx\_status,&idx1,ORB\_PRIO\_DEFAULT);  
pub2 = orb\_advertise\_multi(ORB\_ID(xxx\_status),&xxx\_status,&idx2,ORB\_PRIO\_DEFAULT);

but when I debug it,I found the idx1 and idx2 all equal 0.  
whether I use it with error way?

---

<div class="post-metadata">

**Author:** ![bkueng](https://discuss.px4.io/letter_avatar_proxy/v4/letter/b/2bfe46/32.png) [@bkueng](https://discuss.px4.io/u/bkueng)\
**Post date:** [April 7, 2017, 3:27pm UTC](https://discuss.px4.io/t/how-to-use-the-topic-orb-advertise-multi-function/2968/2 "2017-04-07T15:27:34Z")

</div>

Hi  
Your code looks correct and the following:

```auto
int inst1, inst2;
orb_advertise_multi(ORB_ID(vehicle_command), &cmd, &inst1, ORB_PRIO_DEFAULT);
orb_advertise_multi(ORB_ID(vehicle_command), &cmd, &inst2, ORB_PRIO_DEFAULT);
PX4_WARN("%i %i", inst1, inst2);

```

works for me and outputs 0, 1. You need to provide more context for us to be able to help.
