For some projects, you'll need to perform action at the exact same time. It might happen, for example, when you want to toggle several LEDs.
To send a command packed in a bundle, just add a string with the name of your bundle at the end of Write or Read command digitalWrite(1, State.HIGH,"BundleName");
. After you packed several messages in the bundle, you can send it with the command SendBundle("BundleName")
.
In this example, the program set the state of all digital pins.
for (int ledNum = 0; ledNum< 13;ledNum++)
{
UduinoManager.Instance.digitalWrite(ledNum, State.HIGH,"SetLed"); // Set the value of the LED and store it in the bundle named "SetLed"
}
// ... more code
UduinoManager.Instance.SendBundle("SetLed");
To optimize your Arduino code, we advise you to look at the advanced examples and create a custom Arduino function.
Tip: Bundles are created automatically when Limit Send Rate is toggled in the panel.
MessageBundle.cs, full example class
Example: Uduino\Examples\Advanced\Bundle and Uduino\Examples\Basic\AnalogRead