Microsoft MakeCode

Power up sequence - large number of devices in array

I am doing some effects with large numbers of mbits powered in series via edge 3v/ground - when power is applied the mbits publish their devicename via Radio so a master control mbit can load up all the child mbit names sequentially into an array. Logically power should flow sequentially through the child mbits and they should fire their start block sequentially (in order). but as soon as I get beyond 4 mbits in series, the start blocks appear to not be sequential (mbit further down the chain runs start block prior to a predecessor). I am unclear on why this is ( or is it possible that there are timing conflicts with how the master mbit is dealing with closely timed radioreceived messages as a large number of child mbits publish their devicename)? The child mbits are running the same codebase so that n-number of child mbits can be added and the effect will cascade through them from 1st to last etc… Any thoughts on this?

1 Like

The radio will definitely drop packets if a large number are coming in all at once. Is the physical order of the mbits important? Or can they be registered in any order so long as all of them are added to the array at some point?

yes the order is important for the led effects to work properly. if the objective is to get child mbits to register sequentially ( in the order they are series connected) with a master mbit, is there another bombproof method that is scalable ( single codebase )?

@peli might have an idea

You could try to sort the device by “device serial number” (control.deviceSerialNumber()) so that the order remains the same for the same set of physical mbits regardless of the packet ordering. Serial number won’t change accross renames. Then you also reorder the device physically to match the serial number ordering.

Add radio.setTransmitSerialNumber(true) so that packets also contain the serial number of the sender device. Hope that helps.

thx for the suggestion - sadly though not a very scalable option… my hope of being able to add n sequential mbits at will seems out of reach :frowning: